implemented user lists
This commit is contained in:
parent
3218253076
commit
c3e81ce6ea
16 changed files with 365 additions and 74 deletions
62
src/php/Entities/GamesList.php
Normal file
62
src/php/Entities/GamesList.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GamesShop\Entities;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use GamesShop\Entities\Account\User;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'games_lists')]
|
||||
final class GamesList
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
|
||||
#[ORM\GeneratedValue]
|
||||
private int|null $id;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private User $owner;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private string|null $name;
|
||||
|
||||
#[ORM\JoinTable(name: 'games_list_claimer')]
|
||||
#[ORM\JoinColumn(name: 'id', referencedColumnName: 'id')]
|
||||
#[ORM\ManyToMany(targetEntity: User::class)]
|
||||
private Collection $claimer;
|
||||
|
||||
/**
|
||||
* @param User $owner
|
||||
* @param string|null $name
|
||||
*/
|
||||
public function __construct(User $owner, ?string $name)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOwner(): User
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getClaimer(): array
|
||||
{
|
||||
return $this->claimer;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue