Scott O'Brien

Symfony not sortable in CRUD

Created: 1/1/2011, 12:15:37 PM

I've recently come up across some problems with the CRUD generator in Symfony, so in case anyone is googling for a solution out there, I'll try and help you along (or at least bump up the page references to the articles that helped me 😉 )

I had a problem today where I was trying to use Symfony's (1.4) generate-admin CRUD generator. The issue was that my titles were not sortable when adjusting the fields to display in the generator.yml file

 actions: ~
 fields: ~
 batch_actions: {}
 object_actions: {}
 display: [pin, **firstName**, **lastName**, location, institution]
 display: [firstName, lastName]
 form: ~
 edit: {}
 new: {}

The issue with the firstName and lastName fields is that, if written like first_name and last_name it will fail to become sortable. I found a solution as to why in a blog post from a man with the same issue (Symfony 1.2)

**Foreign keys not Sortable:**Another issue I had was where there is a foreign key in Symfony, the CRUD generator won't know how to make this sortable. I solved this by moving to ahAdminGeneratorThemesPlugin for the generate-admin modules.. Read the read-me in that guide and you'll be sweet! 🙂

Also See