I want to dynamically change my routes based on settings was stored in database, how I can do this in Symfony2?
You can use this bundle to replace Symfony default routing system to a dynamic one.
Related
I have created a route Loader that creates concrete routes that points to controller. This concrete routes are based on entities so if I create or update an entity the corresponding routes needs to be created or updated. Until now the only way of doing this is using cache:clear command but I want to avoid this in production environment. I would like to just refresh the routes collection but I'm not sure if it's possible.
I am creating an app that will be extended by several bundles. Users will have access to different bundles based on roles. Some of these bundles will have configuration options, and I want one page with all config forms.
What I want to do is create a page that every bundle will "hook" into, and show the configuration form if the bundle has one.
There will also be a dashboard page that each bundle should "hook" into and show a dashboard widget.
Is there any way of achieving this in symfony? And if so, how?
I finally understood the The DependencyInjection Component so I guess the answer lies there. In detail, I will try to create an event in the configuration controller, and all bundles will have a subscriber to this event, and somehow have the forms available for the configuration twig file. But that is another question.
I have a some entities in a Symfony bundle which has its own field configuration in the bundle.
For example: FOSUserBundle.
Now, I want to add some more configuration through annotation or xml.
For example: I want to apply some serialization parameters or Assert validation or Gedmo parameters. How can I achieve this without rewriting the whole entity?
I 'm a new with Symfony2!. Can you tell me please if I can user CRUD with FOSUserBundle?? Is that even possible ? Actually, i want create a Manager role who can edit and delete users form database !
FosUserBundle doesn't provide such functionality. You can generate CRUD using Symfony standard edition built in task:
php app/console doctrine:generate:crud
for your User entity.
For more complex purposes you need to check some admin bundles, maybe SonataAdminBundle . This will provide admin generator in which you can manage (CRUD) your entities.
Also note, that using all kinds of code generators is considered as not-so-good-practice
For those who are facing this issue :
- if you override the parent classe with custom fields (let's say "firstname" + "lastname") in you User entity
- and then re-generate the CRUD
you will see that the 2 custom field became editable.
The Doctrine CRUD generator looks incompatible with FOSUserBundle in the present state, as we create inheritance with a User master class.
There is a same issue if you try to use the Group Model of FOSUserBundle.
Is this possible to create bundle without default controller and route?
Yes, it is. Only required file in the bundle is the bundle class.
Read more in the official documentation: http://symfony.com/doc/current/book/page_creation.html#the-bundle-system