73 lines
1.4 KiB
PHP
73 lines
1.4 KiB
PHP
|
<?php namespace RVR\PersistentData\Model;
|
||
|
|
||
|
use SokoWeb\PersistentData\Model\Model;
|
||
|
|
||
|
class CommunityMember extends Model
|
||
|
{
|
||
|
protected static string $table = 'community_members';
|
||
|
|
||
|
protected static array $fields = ['community_id', 'user_id', 'owner'];
|
||
|
|
||
|
protected static array $relations = ['community' => Community::class, 'user' => User::class];
|
||
|
|
||
|
private ?Community $community = null;
|
||
|
|
||
|
private ?int $communityId = null;
|
||
|
|
||
|
private ?User $user = null;
|
||
|
|
||
|
private ?int $userId = null;
|
||
|
|
||
|
private bool $owner = false;
|
||
|
|
||
|
public function setCommunity(Community $community): void
|
||
|
{
|
||
|
$this->community = $community;
|
||
|
}
|
||
|
|
||
|
public function setCommunityId(int $communityId): void
|
||
|
{
|
||
|
$this->communityId = $communityId;
|
||
|
}
|
||
|
|
||
|
public function setUser(User $user): void
|
||
|
{
|
||
|
$this->user = $user;
|
||
|
}
|
||
|
|
||
|
public function setUserId(int $userId): void
|
||
|
{
|
||
|
$this->userId = $userId;
|
||
|
}
|
||
|
|
||
|
public function setOwner(bool $owner): void
|
||
|
{
|
||
|
$this->owner = $owner;
|
||
|
}
|
||
|
|
||
|
public function getCommunity(): ?Community
|
||
|
{
|
||
|
return $this->community;
|
||
|
}
|
||
|
|
||
|
public function getCommunityId(): ?int
|
||
|
{
|
||
|
return $this->communityId;
|
||
|
}
|
||
|
|
||
|
public function getUser(): ?User
|
||
|
{
|
||
|
return $this->user;
|
||
|
}
|
||
|
|
||
|
public function getUserId(): ?int
|
||
|
{
|
||
|
return $this->userId;
|
||
|
}
|
||
|
|
||
|
public function getOwner(): bool
|
||
|
{
|
||
|
return $this->owner;
|
||
|
}
|
||
|
}
|