Using Zend Framework and Doctrine with Independent Modular Structures

I have seen many articles about integrating ZF and Doctrine. There is also a suggestion for ZF here , but they always have two possible structures. Either they put all the models in one top-level model catalog, or put it in the catalog associated with the module.

application
| - Bootstrap.php
| - configs
| - controllers
| - models - EITHER HERE
| - modules
| - examplemodule
| | - controllers
| | - models - OR HERE
| | - views
| - views

For our projects, I see problems for one of two options:
1. One directory: application / models - in a complex system in a short time there will be hundreds of files, in all cases when you have two table classes (for example, User.php and UserTable .php).
2. Module-based model catalogs: application / modules / examplemodule / models - in many cases we use models in several modules at the same time. Therefore, a "User" is required, for example. in the modules "game", "administration", ...

Is there a way to use some subdirectories under the top level directory of the “model” to get some grouping. It must be completely independent of the structure of the module.

application
| - Bootstrap.php
...
| - models
| - user
| | - User.php
|       |-- Friend.php
|       |-- other user related models
|   -- game
|       |-- Game.php
|       |-- Score.php
|       |-- ...
...

yaml.

, ? !

+3
4

, .

Zend, :

|----application
|--------modules
|------------content
|----------------models
|--------------------Base
|------------------------Content.php
|--------------------Content.php

, zf cli, , .

, , Zend Community.

+1

. , , , . , KISS YAGNI. , . .

, , , , .

0

? - ?

How not to directly use the user model in the game module, but rather to transfer the user adapter to the game module by configuration?

After all, modules do not make sense when they are not interchangeable.

0
source

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


All Articles