PHP7 - className issue

Hi,

What is the update for className? I tried to change to classname:class , but it gives error "Call to undefined".

such as:




public function getUser()

	{

		//return $this->hasOne(User::className(), ['id' => 'uid']);

		return $this->hasOne(User::class(), ['id' => 'uid']);

	}



error




"name": "Exception",

    "message": "Call to undefined method app\\models\\User::class()",

    "code": 0,

    "type": "Error",



THX

Any idea?

Check the documentation - className

as it say use ::class not ::class()

1 Like

Thanks … this generated by gii.