Fixed errors when setting setParent on a proxied AbstractStructuralDBElement

This commit is contained in:
Jan Böhmer 2023-06-13 21:00:25 +02:00
parent 19530a9102
commit 78b0e1bf7e

View file

@ -26,6 +26,7 @@ use App\Entity\Attachments\Attachment;
use App\Entity\Parameters\AbstractParameter;
use App\Repository\StructuralDBElementRepository;
use App\EntityListeners\TreeCacheInvalidationListener;
use Doctrine\Common\Proxy\Proxy;
use Doctrine\DBAL\Types\Types;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Parameters\ParametersTrait;
@ -348,11 +349,6 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
throw new \InvalidArgumentException('You can not use one of the element childs as parent!');
} */
//Ensure that the parent is of the same type as this element
if (!$new_parent instanceof static) {
throw new \InvalidArgumentException('The parent must be of the same type as this element!');
}
$this->parent = $new_parent;
//Add this element as child to the new parent