I rightly do not know what this all is
This commit is contained in:
parent
af6b2b752e
commit
287c1f67c5
78 changed files with 3484 additions and 3365 deletions
|
@ -1,96 +1,96 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
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 implements JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
|
||||
#[ORM\GeneratedValue]
|
||||
private int|null $id;
|
||||
#[ORM\ManyToOne]
|
||||
private Game $game;
|
||||
#[ORM\ManyToOne]
|
||||
private GamesList $list;
|
||||
#[ORM\Column]
|
||||
private string $key;
|
||||
#[ORM\Column(type: 'string', enumType: Store::class)]
|
||||
private Store $store;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private string|null $storeLink;
|
||||
#[ORM\Column]
|
||||
private string|null $fromWhere;
|
||||
#[ORM\Column(type: 'integer', enumType: KeyState::class)]
|
||||
private KeyState $state;
|
||||
|
||||
public function __construct(Game $game, GamesList $list, string $key, Store $store, ?string $storeLink, ?string $fromWhere)
|
||||
{
|
||||
$this->game = $game;
|
||||
$this->list = $list;
|
||||
$this->key = $key;
|
||||
$this->store = $store;
|
||||
$this->storeLink = $storeLink;
|
||||
$this->fromWhere = $fromWhere;
|
||||
$this->state = KeyState::AVAILABLE;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getGame(): Game
|
||||
{
|
||||
return $this->game;
|
||||
}
|
||||
|
||||
public function getContributedUser(): User
|
||||
{
|
||||
return $this->contributedUser;
|
||||
}
|
||||
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getStore(): Store
|
||||
{
|
||||
return $this->store;
|
||||
}
|
||||
|
||||
public function getStoreLink(): ?string
|
||||
{
|
||||
return $this->storeLink;
|
||||
}
|
||||
|
||||
public function getFromWhere(): ?string
|
||||
{
|
||||
return $this->fromWhere;
|
||||
}
|
||||
|
||||
public function getState(): KeyState
|
||||
{
|
||||
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,
|
||||
];
|
||||
}
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
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 implements JsonSerializable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
|
||||
#[ORM\GeneratedValue]
|
||||
private int|null $id;
|
||||
#[ORM\ManyToOne]
|
||||
private Game $game;
|
||||
#[ORM\ManyToOne]
|
||||
private GamesList $list;
|
||||
#[ORM\Column]
|
||||
private string $key;
|
||||
#[ORM\Column(type: 'string', enumType: Store::class)]
|
||||
private Store $store;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private string|null $storeLink;
|
||||
#[ORM\Column]
|
||||
private string|null $fromWhere;
|
||||
#[ORM\Column(type: 'integer', enumType: KeyState::class)]
|
||||
private KeyState $state;
|
||||
|
||||
public function __construct(Game $game, GamesList $list, string $key, Store $store, ?string $storeLink, ?string $fromWhere)
|
||||
{
|
||||
$this->game = $game;
|
||||
$this->list = $list;
|
||||
$this->key = $key;
|
||||
$this->store = $store;
|
||||
$this->storeLink = $storeLink;
|
||||
$this->fromWhere = $fromWhere;
|
||||
$this->state = KeyState::AVAILABLE;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getGame(): Game
|
||||
{
|
||||
return $this->game;
|
||||
}
|
||||
|
||||
public function getContributedUser(): User
|
||||
{
|
||||
return $this->contributedUser;
|
||||
}
|
||||
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getStore(): Store
|
||||
{
|
||||
return $this->store;
|
||||
}
|
||||
|
||||
public function getStoreLink(): ?string
|
||||
{
|
||||
return $this->storeLink;
|
||||
}
|
||||
|
||||
public function getFromWhere(): ?string
|
||||
{
|
||||
return $this->fromWhere;
|
||||
}
|
||||
|
||||
public function getState(): KeyState
|
||||
{
|
||||
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