M
M
Marat Galiev2010-09-27 14:17:59
symfony
Marat Galiev, 2010-09-27 14:17:59

Symfony routing.yml, URL generation

Hello everyone, there are 2 modules
company and post,
post is described as follows: I don’t quite understand how to compose a route in such a way that I would get the url of the form: If you do this (it won’t work of course): Then you can specify only 1 model, but how to do it so that 2 models would be used in url generation? Thank you.

post:
class: sfDoctrineRouteCollection
options: { model: BlogPost }


/company/24/mycompany/show/post/13


post_new:
url: /company/:id/:title/show/:post/:post_id
param: { module: company, action: show }
class: sfDoctrineRoute
options: { model: BlogPost }



Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
burgua, 2010-09-27
@burgua

routing.yml
-

post_new:
url:/cc_company/:cc_id/:title/show/:post/:post_id

BlogPost.class.php
_
...

public function getCcId(){
  return $this->getCompany()->getId();
}

public function getCcTitle(){
  return $this->getCompany()->getTitle();
}


...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question