mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Allow to add/delete attachments via part edit page.
This commit is contained in:
parent
fcfab982a8
commit
3a11933a89
12 changed files with 370 additions and 50 deletions
|
@ -31,6 +31,7 @@
|
|||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
@ -48,4 +49,14 @@ class PartAttachment extends Attachment
|
|||
*/
|
||||
protected $element;
|
||||
|
||||
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||
{
|
||||
if (!$element instanceof Part) {
|
||||
throw new \InvalidArgumentException("The element associated with a PartAttachment must be a Part!");
|
||||
}
|
||||
|
||||
$this->element = $element;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue