Symfony generator generator: to be or not to be?

in the latest projects that I started, I wondered if I should use the admin generator or not. My usual choice is not to use it, as some developers suggested to me, "if it is not for rapid prototyping of prototypes and providing it to the client," they said. I'm currently starting a project, and I am in a situation where the client really needs a backend to start downloading a lot of data, and I doubt whether or not to use the admin code generator. I would use it, if necessary, simple form fields. But one of my models should have several images, and maybe I need a more complex presentation that allows the client to upload N images, so the admin generator may not be the best choice, but it seems fast, it seems to save time and that what i need now, save time! The project is very simple, it is just a product model with several images and several sizes and belongs to a simple category. What do you think? What would be the best option for this? And where, in your opinion, does it make sense to use the admins generator or the regular modules generator? Thank you in advance! Best wishes.

+4
source share
2 answers

I use the admin generator as much as possible. It is really designed to be great for the backend of your site - administrative screens that authors and editors will use to support the application. Any module that needs to be editable by the user and just screams for the admin generator.

Recently, I started with the admins generator so that a prototype for creating data would work there. Then I select the specific modules or species that need a more magical sauce, and create them with more customization.

Remember that you can add views and forms to the admin generator module. In my last project, I used the admin generator generator for the "modify" action of my main object, but added the "show" methods similar to the form without an administrator, adding the executeShow() and showSuccess .

Another thing to keep in mind is that the admin generator is only a generator . It writes a bunch of code for you to cache/frontend/env/modules , but you can override any of them by creating the equivalent code in apps/frontend/modules/ . If you find one part of it that cannot be configured using the .yml generator, you can copy the file from the cache to the module directory and crack it. I prefer to use the admin generator out of the box as much as possible before setting it up.

+10
source

I have been working with symfony for a long time, and I used the admin generator for simple and complex situations. Itโ€™s true that it saves time when developing CRUD modules, but I donโ€™t think it is impractical for complex cases.

I think you should use it, and also find out what setting the generator gives. If you have a complex form, leave this to the class classes for management and, as you said, if your forms are more difficult to render, you only need to take care of rendering this only segment of the view.

But if you decide to do it, if without it, you should start thinking about creating the whole view from the scrap, which in my case takes quite a lot of time (I'm not so universal with css).

But this is only my opinion, I hope that this will help you make a more rational choice!

+1
source

Source: https://habr.com/ru/post/1332535/


All Articles