Hi, I'm new to Phalcon. I'm porting my app from my custom framework (i know...) to Phalcon. I will have about 50+ models and controllers with possibly custom event managers, model managers, etc.
How would you structure your folders? I rather not have this:
- app
-
- config
-
- library
-
- models (with 50+ files)
-
- controllers (with 50+ files)
-
- eventmanagers (with 50+ files)
-
- modelmanagers (with 50+ files)
-
- forms (with 50+ files)
-
- etc etc Like this when I want to refactor something, I need to dig in different directories to find all the related classes of a model.
Instead how about this:
- app
-
- config
-
- library
-
- entities
-
-
- Base
-
-
-
-
- Model (extends \Phalcon\Model)
-
-
-
-
-
- Controller (extends \Phalcon\Controller)
-
-
-
-
-
- EventManager (extends \Phalcon\EventManager)
-
-
-
-
-
- ModelManager (extends \Phalcon\ModelManager)
-
-
-
-
- Product
-
-
-
-
- Model (extends Base/Model)
-
-
-
-
-
- Controller (extends Base/Contoller)
-
-
-
-
-
- EventManager (extends Base/EventManager)
-
-
-
-
-
- ModelManager (extends Base/ModelManager)
-
-
-
-
- Seller
-
-
-
-
- Model (extends Base/Model)
-
-
-
-
-
- Controller (extends Base/Contoller)
-
-
-
-
-
- EventManager (extends Base/EventManager)
-
-
-
-
-
- ModelManager (extends Base/ModelManager)
-
-
This way e.g. when I want to change something that effects all model, I just change that in the entities/Base/Model. When I wanto to refactor the Product I change the related files only in that directory. If an entity (e.g. Seller) has some more complex logic and maybe needs some helper classes, they can all be found in the entities/Seller folder.
Any opinion/advice/criticism is appreciated.