This commit is contained in:
21 files changed
+844
-15
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php namespace RVR\PersistentData\Model;
|
||||
|
||||
use DateTime;
|
||||
use SokoWeb\PersistentData\Model\Model;
|
||||
|
||||
class Community extends Model
|
||||
{
|
||||
protected static string $table = 'communities';
|
||||
|
||||
protected static array $fields = ['name', 'currency', 'created'];
|
||||
|
||||
private string $name = '';
|
||||
|
||||
private string $currency = '';
|
||||
|
||||
private DateTime $created;
|
||||
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function setCurrency(string $currency): void
|
||||
{
|
||||
$this->currency = $currency;
|
||||
}
|
||||
|
||||
public function setCreatedDate(DateTime $created): void
|
||||
{
|
||||
$this->created = $created;
|
||||
}
|
||||
|
||||
public function setCreated(string $created): void
|
||||
{
|
||||
$this->created = new DateTime($created);
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getCurrency(): string
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
public function getCreatedDate(): DateTime
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
public function getCreated(): string
|
||||
{
|
||||
return $this->created->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,11 @@ class User extends Model implements IUser
|
||||
return $this->nickname ?: $this->fullName;
|
||||
}
|
||||
|
||||
public function getFullDisplayName(): string
|
||||
{
|
||||
return $this->nickname ? $this->nickname . ' (' . $this->fullName . ')' : $this->fullName;
|
||||
}
|
||||
|
||||
public function checkPassword(string $password): bool
|
||||
{
|
||||
if ($this->password === null) {
|
||||
|
||||
Reference in new issue
Block a user