['bonus:read', 'employee:read'], 'datetime_format' => 'Y-m-d', ], denormalizationContext: [ 'groups' => ['bonus:write'], 'datetime_format' => 'Y-m-d', ], order: ['month' => 'DESC'], paginationEnabled: false, )] #[ApiFilter(DateFilter::class, properties: ['month'])] #[ApiFilter(SearchFilter::class, properties: ['employee' => 'exact'])] #[ORM\Entity(repositoryClass: BonusRepository::class)] #[ORM\Table(name: 'bonuses')] class Bonus { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] #[Groups(['bonus:read'])] private ?int $id = null; #[ORM\ManyToOne(targetEntity: Employee::class)] #[ORM\JoinColumn(nullable: false)] #[Groups(['bonus:read', 'bonus:write'])] private ?Employee $employee = null; #[ORM\Column(type: 'date_immutable')] #[Groups(['bonus:read', 'bonus:write'])] private ?DateTimeImmutable $month = null; #[ORM\Column(type: 'float')] #[Groups(['bonus:read', 'bonus:write'])] private float $amount = 0; #[ORM\Column(type: 'text', nullable: true)] #[Groups(['bonus:read', 'bonus:write'])] private ?string $comment = null; #[ORM\Column(type: 'datetime_immutable')] #[Groups(['bonus:read'])] private DateTimeImmutable $createdAt; public function __construct() { $this->createdAt = new DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getEmployee(): ?Employee { return $this->employee; } public function setEmployee(?Employee $employee): self { $this->employee = $employee; return $this; } public function getMonth(): ?DateTimeImmutable { return $this->month; } public function setMonth(?DateTimeImmutable $month): self { $this->month = $month; return $this; } public function getAmount(): float { return $this->amount; } public function setAmount(float $amount): self { $this->amount = $amount; return $this; } public function getComment(): ?string { return $this->comment; } public function setComment(?string $comment): self { $this->comment = $comment; return $this; } public function getCreatedAt(): DateTimeImmutable { return $this->createdAt; } }