Z
Z
zenaku2016-08-10 15:12:28
symfony
zenaku, 2016-08-10 15:12:28

Do I need to split into separate bundles?

There was a question about determining the number of bundles in a Symfony project.
There is a database with ~15 tables (the number of which will grow), which are interconnected "one-to-many", "many-to-many". The application will have to actively work with tables, constantly querying the database with pulling several tables through joins, changes, and so on. All these tables are transferred to AppBundle / Entity /, where they are edited as necessary and upgrade the database (when developing, in fact, the application). But keeping everything in one bundle is a bunch of controllers, forms, and views. I would like to logically break it into bundles - this bundle is for working with projects, this bundle is for working with users, this is for viewing tasks for users, and so on. But everything rests on the fact that it is then necessary to access the entities in the AppBundle, otherwise, you can create copies of entities in different bundles of the same table (the problem with updating the database and repeating the code). There is also a problem with the flexibility and independence of bundles. But on the other hand, the bundles are logically separated, it is convenient to disable functionality, update via git, etc.
In general, how to divide into bundles with such a database structure?
PS There is a desire to create a separate bundle for entities, to which to register the dependency of all other bundles

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Skobkin, 2016-08-10
@zenaku

Create only one bundle called AppBundle for your application logic.

From Symfony Best Practices - Creating The Project - Application Bundles .
Roughly speaking, if the parts of the logic that you want to separate are not self-sufficient and cannot be used separately, there is no point in separating them. But if you, for example, are writing a bundle that will be used in several projects, then it makes sense.
I don't know exactly how dependent some parts are on others, but in your case it might be better to just make a hierarchy of directories inside the bundle.
In my opinion, you yourself did not understand what you wrote. If you give an example, it will be clearer.
Will you disable functionality so often? And what's wrong with git?
In some cases they do. For example, we have entity bundles for various external services. But they are made in the form of separate bundles, because. are used in several projects and on other projects, part of the logic that works with them on the main one is not needed.

S
shagguboy, 2016-08-10
@shagguboy

in one bundle, you can make subdirectories, each of which, according to the architecture of the symphony, will be its own namespace, and scatter it among these directories.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question