Symfony not sortable in CRUD
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
config:
actions: ~
fields: ~
list:
batch_actions: {}
object_actions: {}
display: [pin, **firstName**, **lastName**, location, institution]
filter:
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
- An interesting post on doing more with the admin generator http://blog.centresource.com/2010/01/13/code-that-saves-the-day-symfony-admin-generator/
- Jobeet Backend Modules page (Very useful) http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12