Centralized setElement logic for *Attachment entities.

This commit is contained in:
Jan Böhmer 2019-11-08 22:05:12 +01:00
parent e66fcc85fc
commit a0c3410db6
14 changed files with 140 additions and 113 deletions

View file

@ -43,13 +43,5 @@ class MeasurementUnitAttachment extends Attachment
*/
protected $element;
public function setElement(AttachmentContainingDBElement $element): Attachment
{
if (!$element instanceof MeasurementUnit) {
throw new \InvalidArgumentException('The element associated with a MeasurementUnitAttachmentAttachment must be a MeasurementUnit!');
}
$this->element = $element;
return $this;
}
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
}