mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 12:40:08 +02:00
Ensure that attachments are not used in preview when deleting, so we do not encounter integrity violations.
This fixes issue #50.
This commit is contained in:
parent
7b108f8d4b
commit
c0b4172f22
2 changed files with 25 additions and 0 deletions
|
@ -111,6 +111,11 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
|
|||
{
|
||||
$this->attachments->removeElement($attachment);
|
||||
|
||||
//Check if this is the master attachment -> remove it from master attachment too, or it can not be deleted from DB...
|
||||
if ($attachment === $this->getMasterPictureAttachment()) {
|
||||
$this->setMasterPictureAttachment(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue