0 follower

Final Class Yiisoft\Rbac\Assignment

InheritanceYiisoft\Rbac\Assignment

Assignment represents an assignment of a role or a permission to a user.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $userId, string $itemName, integer $createdAt )
$userId string

The user ID. This should be a string representing the unique identifier of a user.

$itemName string

The role or permission name.

$createdAt integer

UNIX timestamp representing the assignment creation time.

                public function __construct(
    private readonly string $userId,
    private string $itemName,
    private readonly int $createdAt,
) {}

            
getAttributes() public method

public array getAttributes ( )
return array

Attribute values indexed by corresponding names.

                public function getAttributes(): array
{
    return [
        'item_name' => $this->getItemName(),
        'user_id' => $this->getUserId(),
        'created_at' => $this->getCreatedAt(),
    ];
}

            
getCreatedAt() public method

public integer getCreatedAt ( )

                public function getCreatedAt(): int
{
    return $this->createdAt;
}

            
getItemName() public method

public string getItemName ( )

                public function getItemName(): string
{
    return $this->itemName;
}

            
getUserId() public method

public string getUserId ( )

                public function getUserId(): string
{
    return $this->userId;
}

            
withItemName() public method

public self withItemName ( string $roleName )
$roleName string

                public function withItemName(string $roleName): self
{
    $new = clone $this;
    $new->itemName = $roleName;
    return $new;
}