Symfony 1.4路由:来自不同类的字段

How is it possible to create and match a route with fields from different classes? Is it possible? Is there any custom routing class?

For example I have these two classes:

File:
  columns:
    name: { type: string(255), unique: true, notnull: true }
    ...

Link:
  columns:
    file_id: { type: bigint, notnull: true }
    ticket: { type: string(64), notnull: true }
  relations:
    File:
      local: file_id
      foreign: id
      foreignAlias: links
  ...

Now suppose I want to create a route like this: mysite.com/:ticket/:name As you can see, ticket is a field of Link table and name is a field of File table. Is there any way to create such links in symfony 1.4?

First solution is to change the primary key of the File table and set it to it's name. I know this, but I wonder if there exist a way to handle this through routing.

My goal is when I called getObject method, it returns a Link object with sent ticket, but the existence and relationship with sent file name should also be checked.

IIRC you can do something like that:

my_route:
  url: /:ticket/:name
  class: sfDoctrineRoute
  param: { module: yourModule, action: yourAction }
  options: { type: object, model: Link, method: findLinkWithSendTicket }

Then symfony should call LinkTable::findLinkWithSendTicket method and pass to it parameters, so you can use it to fetch object.

Links can be helpful: