mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-26 04:49:32 +00:00
Added possibility to access PartAssociations via API
This commit is contained in:
parent
4d7d196a3c
commit
3e6b80d1cf
3 changed files with 142 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ use App\Entity\Parts\Part;
|
|||
use App\Entity\Parts\PartAssociation;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints\Valid;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ trait AssociationTrait
|
|||
#[Valid]
|
||||
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: PartAssociation::class,
|
||||
cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[Groups(['part:read', 'part:write'])]
|
||||
protected Collection $associated_parts_as_owner;
|
||||
|
||||
/**
|
||||
|
|
@ -46,6 +48,7 @@ trait AssociationTrait
|
|||
#[Valid]
|
||||
#[ORM\OneToMany(mappedBy: 'other', targetEntity: PartAssociation::class,
|
||||
cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[Groups(['part:read'])]
|
||||
protected Collection $associated_parts_as_other;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue