I have a Page
object whose uniqueness comes from its PageDomain
. The schema is configured such that the page
table contains a page_domain_id
field to create the relationship. To show a page, I have an executeShow
action and a custom handler. My route looks like this:
page_show:
url: /:domain_slug/:slug
class: sfPropelRoute
options:
model: Page
type: object
method_for_criteria: doSelectByDomain
param: { module: page, action: show }
requirements:
sf_method: [get]
By way of an example, I might have /audience/create
and also /behavior/create
. I need to be able to determine which page is being requested.
The intent of the custom handler (doSelectByDomain
) is to factor in the domain_slug
and only retrieve/show a page if its domain is also correct. What I'm finding, though, is that even though a domain_slug
parameter is available in the action's $request
parameter, I have no way of getting it to my custom handler so that it can be factored into what's retrieved.
I realize that I can access the sfContext
object directly from my model, but that's inelegant at best and breaks MVC. I'm not afraid to use it if there's really no better way, but it seems like there must be. Symfony offers a setListCriteria
method for list routes, but I can't find anything similar for object routes.
Help? Thanks.