feat : reception.entryCompleted + relation inverse bovines + filtres
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,13 +31,14 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
#[ORM\Entity]
|
||||
#[ORM\HasLifecycleCallbacks]
|
||||
#[ORM\Table(name: 'reception')]
|
||||
#[ApiFilter(BooleanFilter::class, properties: ['isValid'])]
|
||||
#[ApiFilter(BooleanFilter::class, properties: ['isValid', 'entryCompleted'])]
|
||||
#[ApiFilter(SearchFilter::class, properties: [
|
||||
'identificationNumber' => 'ipartial',
|
||||
'supplier.name' => 'ipartial',
|
||||
'carrier.name' => 'ipartial',
|
||||
'licensePlate' => 'ipartial',
|
||||
'receptionType.id' => 'exact',
|
||||
'receptionType.code' => 'exact',
|
||||
])]
|
||||
#[ApiFilter(DateFilter::class, properties: ['receptionDate'])]
|
||||
#[ApiResource(
|
||||
@@ -110,6 +111,10 @@ class Reception
|
||||
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
|
||||
private bool $isValid = false;
|
||||
|
||||
#[ORM\Column(options: ['default' => false])]
|
||||
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
|
||||
private bool $entryCompleted = false;
|
||||
|
||||
#[ORM\Column(name: 'date_reception', type: 'datetime_immutable')]
|
||||
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
|
||||
#[Context(
|
||||
@@ -204,6 +209,12 @@ class Reception
|
||||
#[Groups(['reception:read', 'reception:write'])]
|
||||
private ?string $bovineDetail = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Bovine>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Bovine::class, mappedBy: 'reception')]
|
||||
private Collection $bovines;
|
||||
|
||||
public function __construct(
|
||||
?DateTimeImmutable $receptionDate = null,
|
||||
) {
|
||||
@@ -212,6 +223,7 @@ class Reception
|
||||
$this->buildings = new ArrayCollection();
|
||||
$this->pelletBuildings = new ArrayCollection();
|
||||
$this->bovines_types = new ArrayCollection();
|
||||
$this->bovines = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -270,6 +282,25 @@ class Reception
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[Groups(['reception:read'])]
|
||||
public function isEntryCompleted(): bool
|
||||
{
|
||||
return $this->entryCompleted;
|
||||
}
|
||||
|
||||
public function setEntryCompleted(bool $entryCompleted): self
|
||||
{
|
||||
$this->entryCompleted = $entryCompleted;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[Groups(['reception:read'])]
|
||||
public function getRegisteredBovineCount(): int
|
||||
{
|
||||
return $this->bovines->count();
|
||||
}
|
||||
|
||||
#[Groups(['reception:read'])]
|
||||
public function getReceptionDate(): ?DateTimeImmutable
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user