Final Class Yiisoft\Rbac\Assignment
| Inheritance | Yiisoft\Rbac\Assignment |
|---|
Assignment represents an assignment of a role or a permission to a user.
Public Methods
Method Details
| 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,
) {}
| 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(),
];
}
| public self withItemName ( string $roleName ) | ||
| $roleName | string | |
public function withItemName(string $roleName): self
{
$new = clone $this;
$new->itemName = $roleName;
return $new;
}
Signup or Login in order to comment.