SyliusResourceBundle¶
Easy CRUD and persistence for Symfony2 apps.
During our work on Sylius, we noticed a lot of duplicated code across all controllers. We started looking for a good solution to the problem. We’re not big fans of administration generators (they’re cool, but not for our use case!) - we wanted something simpler and more flexible.
Another idea was to not limit ourselves to one persistence backend. Initial implementation included custom manager classes, which was quite of an overhead, so we decided to simply stick with Doctrine Common Persistence interfaces. If you are using Doctrine ORM or any of the ODM’s, you’re already familiar with those concepts. Resource bundle relies mainly on the ObjectManager and ObjectRepository interfaces.
The last annoying problem this bundle tries to solve, is having separate “backend” and “frontend” controllers, or any other duplication for displaying the same resource, with different presentation (view). We also wanted an easy way to filter some resources from list, sort them or display them by id, slug or any other criteria - without having to define another super simple action for that purpose.
If these are issues you’re struggling with, this bundle may be helpful!
Please note that this bundle is not an admin generator. It won’t create forms, filters and grids for you. It only provides format agnostic controllers as foundation to build on, with some basic sorting and filter mechanisms.
- 1. Installation
- 2. Configuring your resources
- 3. Getting single resource
- 4. Getting collection of resources
- 5. Creating resource
- 6. Updating resource
- 7. Deleting resource
- 8. Managing flash messages
- 9. Doctrine tools
- 10. Extra tools
- 11. Defining custom action
- 12. Collection form type
- 13. Summary