implemented user lists
This commit is contained in:
parent
3218253076
commit
c3e81ce6ea
16 changed files with 365 additions and 74 deletions
|
@ -5,10 +5,12 @@ namespace GamesShop\Entities\Games;
|
|||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use GamesShop\Entities\Account\User;
|
||||
use GamesShop\Entities\GamesList;
|
||||
use JsonSerializable;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'keys')]
|
||||
final class Key
|
||||
final class Key implements JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
|
||||
|
@ -17,7 +19,7 @@ final class Key
|
|||
#[ORM\ManyToOne]
|
||||
private Game $game;
|
||||
#[ORM\ManyToOne]
|
||||
private User $contributedUser;
|
||||
private GamesList $list;
|
||||
#[ORM\Column]
|
||||
private string $key;
|
||||
#[ORM\Column(type: 'string', enumType: Store::class)]
|
||||
|
@ -29,10 +31,10 @@ final class Key
|
|||
#[ORM\Column(type: 'integer', enumType: KeyState::class)]
|
||||
private KeyState $state;
|
||||
|
||||
public function __construct(Game $game, User $contributedUser, string $key, Store $store, ?string $storeLink, ?string $fromWhere)
|
||||
public function __construct(Game $game, GamesList $list, string $key, Store $store, ?string $storeLink, ?string $fromWhere)
|
||||
{
|
||||
$this->game = $game;
|
||||
$this->contributedUser = $contributedUser;
|
||||
$this->list = $list;
|
||||
$this->key = $key;
|
||||
$this->store = $store;
|
||||
$this->storeLink = $storeLink;
|
||||
|
@ -79,4 +81,16 @@ final class Key
|
|||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'key' => $this->key,
|
||||
'store' => $this->store->value,
|
||||
'store_link' => $this->storeLink,
|
||||
'from_where' => $this->fromWhere,
|
||||
'state' => $this->state->value,
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue