public function setUser($value) : Permission
    {
        // Is this a scalar value representing the ID of this foreign key?
        if (is_scalar($value)) {
            return $this->setUserId($value);
        }

        // Is this an instance of User?
        if (is_object($value) && $value instanceof User) {
            return $this->setUserObject($value);
        }

        // Is this an array representing a User item?
        if (is_array($value) && !empty($value['id'])) {
            return $this->setUserId($value['id']);
        }

        // None of the above? That's a problem!
        throw new \Exception('Invalid value for User.');
    }
public function setUser($value) : Permission
    {
        // Is this a scalar value representing the ID of this foreign key?
        if (is_scalar($value)) {
            return $this->setUserId($value);
        }

        // Is this an instance of User?
        if (is_object($value) && $value instanceof User) {
            return $this->setUserObject($value);
        }

        // Is this an array representing a User item?
        if (is_array($value) && !empty($value['id'])) {
            return $this->setUserId($value['id']);
        }

        // None of the above? That's a problem!
        throw new \Exception('Invalid value for User.');
    }
public function setUser ( $ value ) : Permission { // Is this a scalar value representing the ID of this foreign key? if ( is_scalar ( $ value ) ) { return $ this -> setUserId ( $ value ) ; } // Is this an instance of User? if ( is_object ( $ value ) && $ value instanceof User ) { return $ this -> setUserObject ( $ value ) ; } // Is this an array representing a User item? if ( is_array ( $ value ) && ! empty ( $ value [ 'id' ] ) ) { return $ this -> setUserId ( $ value [ 'id' ] ) ; } // None of the above? That's a problem! throw new \ Exception ( 'Invalid value for User.' ) ; }
Set User - Accepts an ID, an array representing a User or a User model.
@throws \Exception
@param $value mixed
@return Permission
Set User - Accepts an ID an array representing a User or a User model .