Answer the question
In order to leave comments, you need to log in
How to call model from common\models in ActiveController REST api?
In api\modules\v1\controllers in the controller, I cannot instantiate a model that is in common\models. If this model is copied to api\modules\v1\models, then you can work with it. Help, please, I can’t understand what’s the catch ... The magic of namespace's ...
Model class:
<?php
namespace common\models;
use \Yii;
class Help extends \yii\db\ActiveRecord
{
public static function tableName()
{
return 'help';
}
}
use \common\models\Help;
class CampaignController extends ActiveController
{
....
public function actionView($id)
{
Help::findOne($id);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question