can not run controller


I am use controller of departments with URL of http://localhost:81/advanced/backend/web/index.php?r=departments in browsers,but after it,the below message showed to me:

Unknown Property – yii\base\UnknownPropertyException

Getting unknown property: backend\models\DepartmentsSearch::companies

That companies is another controller.

Please help to me?

if u want to use companies of another model u can use by join table or defined variable in DepartmentsSearch.

ref this: join with

one more thing companies is not from controller it is from different model.