hasOne relation is not working for me

Hi.

I have a hasOne relation, which is not working for me, but I do not find why.

So, here the property calling:


var_dump($entity->activity) //which cause the above pasted error message.



But in the House AR model I defined the following hasOne relation:




/**

 * // Properties.

 *

 * @property Activity $activity

 */

class House extends \yii\db\ActiveRecord

{

   //Codes.


    /**

     * @return \yii\db\ActiveQuery

     */

    public function getActivity()

    {

        return $this->hasOne(Activity::className(), ['entity' => Activity::ENTITY_HOUSE, 'entity_id' => 'id']);

    }



The other hasOne relations work fine, but not this one.