Access User Model Attributes

Hi guys, may I know how could I access the "private" value as object below?

I’m using yii2 and had a relation to User model.


object(app\models\User)#207 (13) { 

["id"]=> NULL 

["username"]=> NULL 

["password"]=> NULL 

["authKey"]=> NULL 

["accessToken"]=> NULL 


["_attributes":"yii\db\BaseActiveRecord":private]=> array(12) {

["id"]=> int(3) 

["username"]=> string(5) "admin" 

["email"]=> string(15) "admin@gmail.com" 

["password_hash"]=> string(60) "$2y$10$c8/WbUJXN88dsSIqRZMA.eT6kcwMvhz2lOydS2TYoush1CsAYRSmC" 

["auth_key"]=> string(32) "F-BBeBXGp2dOnxvpDlM7zcqlC3Oj2tB0" 

["confirmed_at"]=> NULL 

["unconfirmed_email"]=> NULL 

["blocked_at"]=> NULL 

["registration_ip"]=> string(3) "::1" 

["created_at"]=> int(1472664016) 

["updated_at"]=> int(1472664016) 

["flags"]=> int(0) } 


["_oldAttributes":"yii\db\BaseActiveRecord":private]=> array(12) { 

["id"]=> int(3) 

["username"]=> string(5) "admin" 

["email"]=> string(15) "admin@gmail.com" 

["password_hash"]=> string(60) "$2y$10$c8/WbUJXN88dsSIqRZMA.eT6kcwMvhz2lOydS2TYoush1CsAYRSmC" 

["auth_key"]=> string(32) "F-BBeBXGp2dOnxvpDlM7zcqlC3Oj2tB0" 

["confirmed_at"]=> NULL 

["unconfirmed_email"]=> NULL 

["blocked_at"]=> NULL 

["registration_ip"]=> string(3) "::1" 

["created_at"]=> int(1472664016) 

["updated_at"]=> int(1472664016) 

["flags"]=> int(0) } ["_related":"yii\db\BaseActiveRecord":private]=> array(0) { } ["_errors":"yii\base\Model":private]=> NULL 

["_validators":"yii\base\Model":private]=> NULL 

["_scenario":"yii\base\Model":private]=> string(7) "default" ["_events":"yii\base\Component":private]=> array(0) { } ["_behaviors":"yii\base\Component":private]=> array(0) { } }

What do you want to do? Can you explain your problem in a bit more specific manner?

A private attribute can only be accessed within the methods that belong to that object. It can’t be accessed outside of that object. It’s what PHP language imposes on you.