docs
docs copied to clipboard
Are we free to put models in any folder location?
I realise documentation is not complete and yii3 is still in development. I am just trying to plan a migration from yii2 to yii3 and the only thing I cannot seem to work from this project is where I stick my "models"
Apologies if this is a stupid question. Very much have my Yii2 hat on.
Is there a recommended directory structure?
My personal approach: keep controller, models and views close together. General Models in a separate folder Models.
I would like to know a recommended or standardized way as requested though.
I imagine we can put them anywhere. But I agree some structure and keeping them together is best.
Do you seperate your business logic into folders like “Blog” and then have controllers, models and views under this directory or in subdirectories ?
Since I have URLs like https://www.domain.tld/category/page I placed files like this:
Control
- Controller.php
- Category
- page.php (view)
- page
- AR.php
- Model.php
Models
- GenericModel.php
I'm sure it's not perfect, but works alright for me. I can always find the files fast I need to edit.
@Mister-42 approach is alright. That should be added to yiisoft/docs.
See https://github.com/yiisoft/app/discussions/238