Reputation: 5902
When configuring my admin generator I created a table_method for my list view in order to join the correct tables and so on.
However, in my edit post / create post sections I have a rather extensive dropdown that is not joined at the moment. Is there an equivalent to table_method that I can use for these situations to specify the method that should be used for retrieving the record?
Thanks in advance.
Upvotes: 0
Views: 1613
Reputation: 11382
You need to modify the respective widget in the form classes. (SomeModelForm.class.php in lib/form/doctrine).
All of the Doctrine widgets accept a "query" option to allow you to pass a Doctrine query to over-ride the default query the form creates, or a "table_method" option that can return a query or a doctrine collection to over-ride the default.
As a reference, see: http://www.symfony-project.org/api/1_4/sfWidgetFormDoctrineChoice
To use query, something along the lines of:
$somedoctrinequery = Doctrine::getTable('ModelName')->createQuery('t')->leftJoin('t.Relation r');
$this->widgetSchema['field_name']->setOption('query', $somedoctrinequery);
Or to use table_method:
$this->widgetSchema['field_name']->setOption('table_method', 'myMethod');
Upvotes: 1