symfony - symfony2 routing requirements combining 2 parameters -


so got in routing.yml:

requirements:     var1: \d+     var2: \d+ 

both checked on own , valid. need check combination of 2, since combination not valid.

for case need check relation between 2 objects in database, first should parent of second. can in controller, don't implementation. also, need same check more 1 route.

how add requirement checks combination? can define method in controller class called?

or best solution like:

public function indexaction($var1, $var2) {     $result = $this->checkrelation($var1, $var2);     if ($result) {         // return errorpage         return $result;     }      // ...  } 

so understand question, want following:

/parent/child/        --> returns 200 /not_parent/not_child --> returns 404 

the symfony2 routing component doesn't natively, extend it.

http://symfony.com/doc/master/cmf/cookbook/using-a-custom-route-repository.html


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -