mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 04:14:36 +02:00
Centralized setElement logic for *Attachment entities.
This commit is contained in:
parent
e66fcc85fc
commit
a0c3410db6
14 changed files with 140 additions and 113 deletions
|
@ -48,13 +48,5 @@ class GroupAttachment extends Attachment
|
|||
*/
|
||||
protected $element;
|
||||
|
||||
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||
{
|
||||
if (!$element instanceof Group) {
|
||||
throw new \InvalidArgumentException('The element associated with a UserAttachment must be a User!');
|
||||
}
|
||||
|
||||
$this->element = $element;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
public const ALLOWED_ELEMENT_CLASS = Group::class;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue