我正在使用 Yii2 框架,我想获取 user_id 的值,即 6,如何将它存储在以下对象的变量中

I am using Yii2 framework and i want to get value of user_id, which is 6, how can i store it in a variable from following object

我正在使用 Yii2 框架,我想获取 user_id 的值,即 6,如何将其存储在以下对象的变量中。

yii\db\ActiveQuery Object
    (
        [sql] => 
        [on] => `enter code here`
        [joinWith] => 
        [select] => 
        [selectOption] => 
        [distinct] => 
        [from] => 
        [groupBy] => 
        [join] => 
        [having] => 
        [union] => 
        [params] => Array()

    [_events:yii\base\Component:private] => Array
        (
        )

    [_behaviors:yii\base\Component:private] => Array
        (
        )

    [where] => 
    [limit] => 
    [offset] => 
    [orderBy] => 
    [indexBy] => 
    [emulateExecution] => 
    [modelClass] => backend\models\User
    [with] => 
    [asArray] => 
    [multiple] => 
    [primaryModel] => backend\models\Vendors Object
        (
            [_attributes:yii\db\BaseActiveRecord:private] => Array
                (
                    [id] => 0
                    [user_id] => 6
                )

            [_oldAttributes:yii\db\BaseActiveRecord:private] => Array
                (
                    [id] => 0
                    [user_id] => 6
                )

            [_related:yii\db\BaseActiveRecord:private] => Array
                (
                )

            [_errors:yii\base\Model:private] => 
            [_validators:yii\base\Model:private] => 
            [_scenario:yii\base\Model:private] => default
            [_events:yii\base\Component:private] => Array
                (
                )

            [_behaviors:yii\base\Component:private] => Array
                (
                )

        )

    [link] => Array
        (
            [id] => user_id
        )

    [via] => 
    [inverseOf] => 
)

可以通过此代码检索该值。 $user_id = $myreturn->primaryModel->attributes['user_id'];