I’ve got a symfony admin generated module for my Poem class. My poem table has a foreign_key constraint to my MasterIndex table (user_id). When using the Symfony admin generator, in list mode, it displays a drop-down filter for my user_id. I can change the data that is being displayed by modifying the __toString() method in my MasterIndex class to display the user name instead of the Id.
How can I sort the data that is being displayed in the filter drop-down?
I found this link which proposes a solution, but the peer_method that it uses only seems to work with Propel.
I’m using Doctrine 1.2 with my Symfony 1.4 project.
You can find available options for the
sfWidgetFormDoctrineChoicehereYou can use the
order_byoption like this:...->setOption('order_by', array('some_field', 'asc')).UPDATE:
If you want to order by multiple fields you can write a custom query and add multiple order by to it and then use the
queryortable_methodoption instead oforder_by.E.g. (you should write the query into a table class instead):