O
O
okkkman2020-10-13 19:00:22
symfony
okkkman, 2020-10-13 19:00:22

Own folder hierarchy in Symfony?

Hello.

I want to implement my own file hierarchy:

src/
-- Migration/
-- Controller/
-- Entity/
-- EventSubscriber/
-- Module/
--- User/
---- Entity/
---- Dto/
---- Repository/
---- Controller/
---- Service/
---- etc.


Can't figure out how to solve three problems:
  1. So that all migration files are stored in /src/Migration and not /migrations ?
  2. To make the annotations of routes and Doctrine (well, Swagger in the future) work not only in /src/Controller and /src/Entity , but also with folder nesting ( /src/Module/User/Controller , /src/Module/User/Entity ) ?
  3. Is it possible to make it possible to specify the path when creating an Entity or Controller via the console (eg php bin/console make:entity )?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2020-10-13
@okkkman

1. https ://github.com/symfony/recipes/blob/master/doc...
migrations are not code.
2. When configuring the container and routes, Kernel.phpyou can disassemble the folder structure and connect everything dynamically there.
3. No. How to create an entity in a non-standard way?
FYI, my folder structure looks like this right now:

migrations/
src/
-- Controller/
---- User/
---- ModuleName/
-- Entity/
---- User/
---- ModuleName/
-- User/
--- Dto/
--- Repository/
--- Service/
-- ModuleName/
--- Dto/
--- Repository/
--- Service/

Firstly, there are no configuration problems, and secondly, if you are included in the project for the first time, it is ideal to immediately see the set of entities and controllers, and not run through the folders of modules in search of them, plus controllers are often difficult to attribute to a particular module .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question