문제

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.

도움이 되었습니까?

해결책

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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top