Search code examples
sortingsymfony1doctrinemany-to-many

Ordered Many-Many Relationship in Doctrine?


Attempting to link Categories to Websites, using WebsiteCategory as the refClass.

WebsiteCategory has a column rank, which indicates the order in which the categories should be retrieved when you call $website->getCategories()

I'm stumped, didn't think this would be so difficult. Can anyone help?


Solution

  • Was not able to get doctrine to order the relationship natively (like Damien was suggesting) instead, added a getCategories() function to the model which runs the proper query and returns the result set.