<?php
declare(strict_types=1);
namespace App\Point\Doctrine\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Point\Doctrine\Repository\OperationRepository;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;
use Symfony\Component\Serializer\Annotation\Groups;
#[ApiResource(
collectionOperations: ['get'],
itemOperations: ['get'],
normalizationContext: ['groups' => ['read']]
)]
#[Entity(OperationRepository::class)]
#[Table(name: '`point_operation`')]
class Operation
{
CONST CODES_TO_HIDE = ['DONATION', 'RETROCESSION'];
#[Id]
#[Column(type: 'integer')]
#[GeneratedValue]
#[Groups('read')]
private ?int $id = null;
#[Column(unique: true)]
#[Groups('read')]
private string $code;
#[Column]
#[Groups('read')]
private string $name;
public function getId(): ?int
{
return $this->id;
}
public function getCode(): string
{
return $this->code;
}
public function setCode(string $code): void
{
$this->code = $code;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
}