| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [ ] TU/TI/TF rédigée - [x] TU/TI/TF OK - [x] CHANGELOG modifié Reviewed-on: #7 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
93 lines
2.0 KiB
PHP
93 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Get;
|
|
use ApiPlatform\Metadata\GetCollection;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Serializer\Attribute\Groups;
|
|
|
|
#[ORM\Entity]
|
|
#[ORM\Table(name: 'merchandise_type')]
|
|
#[ApiResource(
|
|
operations: [
|
|
new Get(
|
|
requirements: ['id' => '\d+'],
|
|
normalizationContext: ['groups' => ['merchandise-type:read']],
|
|
),
|
|
new GetCollection(
|
|
normalizationContext: ['groups' => ['merchandise-type:read']],
|
|
),
|
|
],
|
|
security: "is_granted('ROLE_USER')",
|
|
)]
|
|
class MerchandiseType
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
#[Groups(['reception:read', 'merchandise-type:read'])]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 120)]
|
|
#[Groups(['reception:read', 'merchandise-type:read'])]
|
|
private string $label = '';
|
|
|
|
#[ORM\Column(length: 50)]
|
|
#[Groups(['reception:read', 'merchandise-type:read'])]
|
|
private string $code = '';
|
|
|
|
/**
|
|
* @var Collection<int, Reception>
|
|
*/
|
|
#[ORM\OneToMany(mappedBy: 'merchandiseType', targetEntity: Reception::class)]
|
|
private Collection $receptions;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->receptions = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getLabel(): string
|
|
{
|
|
return $this->label;
|
|
}
|
|
|
|
public function setLabel(string $label): self
|
|
{
|
|
$this->label = $label;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCode(): string
|
|
{
|
|
return $this->code;
|
|
}
|
|
|
|
public function setCode(string $code): self
|
|
{
|
|
$this->code = $code;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Reception>
|
|
*/
|
|
public function getReceptions(): Collection
|
|
{
|
|
return $this->receptions;
|
|
}
|
|
}
|