Answer the question
In order to leave comments, you need to log in
How to develop a module in Yii2 and then easily connect it?
Hello. An urgent question has ripened for me.
I want to develop a module for Yii2, which can be easily connected to other projects in the future, say through composer. From here some questions:
1. How to organize migrations or import of necessary tables?
2. How to prevent table intersections in the database?
3. How to create a module that has both a backend and a frontend part?
4. How to do it most transparently for the developer who implements this product?
This question is more about working out the structure of such an application. It is necessary to form an ideal solution, well, or almost ideal)
For example, I want to develop a "news" module with my own database table structure. And I want a similar module to be installed through composer. Where should I look to get such a solution?
I hope for your support, friends.
Answer the question
In order to leave comments, you need to log in
1. How to arrange migrations or import of required tables?
standard. Put the migrations in module/migrations, in the readme specify the command for migration with --migrationPath
2. How to prevent table intersections in the database?
name tables like this
public function tableName()
{
return '{{%moduleName_tableName}}';
}
See how the extensions are arranged in the official repository
. Tables can be named with a certain prefix to prevent overlaps.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question