I am working on the web app . For this site I need to sync data from the third server for which I have to create a cron(basically a console app), that is using active records and models from the app .
I want to know what can be the best structure so as to use common active records and models with replication.
I’ll use Yii2 Advanced template and insert all your shared models in \common\models. So other apps ( \backend, \frontend, ecc…) could point directly to \common\models or make subclass in their models folder only for mantain a centralization of models.
/* in \common\models\User.php
/* in \yourapp\models\User.php
class User extends \common\models\User
I hope I have understood correctly your request
How can I use model from web app directly in console app ?
In console app you make reference to \common\models or other namespace.
No difference with web app.