I
I
Ivanoff-i2017-05-08 19:17:45
Yii
Ivanoff-i, 2017-05-08 19:17:45

How to store common models and business logic for multiple projects?

There are several different Yii2 projects in different repositories, but there are places where they can use the same business logic and AR. Where is the best place to move these components so as not to duplicate them in each repository? Are there other options besides creating an extension?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Crash, 2017-05-09
@Bandicoot

We did this at work. All projects are stored in one folder on the server, both on the test and on the production one. In it, a separate project was created with common models and components, namespaces were configured:
In the project where these common models are needed, we prescribe the appropriate alias for them:

$config = [
  ...
  'aliases' => [
    '@common' => dirname(__DIR__) . '/../common'
  ]
  ...
];

Then they can be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question