mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Do the doctrine definitions of the master preview attachment in the sub classes
This makes lazy fetching works and saves some db queries.
This commit is contained in:
parent
2c6de84c9a
commit
2ddfe48aba
14 changed files with 73 additions and 6 deletions
|
@ -33,10 +33,10 @@ trait MasterAttachmentTrait
|
|||
{
|
||||
/**
|
||||
* @var Attachment|null
|
||||
* Mapping is done in the subclasses (e.g. Part), like with the attachments.
|
||||
* If this is done here (which is possible in theory), the attachment is not lazy loaded anymore, which causes unnecessary overhead.
|
||||
*/
|
||||
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
|
||||
#[ORM\ManyToOne(targetEntity: Attachment::class)]
|
||||
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue