fix issue with node attributes

This commit is contained in:
Simon Vieille 2021-05-16 11:56:36 +02:00
parent 5546bfb114
commit 5bc880ee12

View file

@ -62,10 +62,7 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
if ($node->getDisableUrl()) {
$node->setUrl(null);
return;
}
} else {
if ($node->getUrl()) {
$generatedUrl = $node->getUrl();
} else {
@ -123,15 +120,6 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
$node->setParameters($parameters);
$attributes = $node->getAttributes();
$realAttributes = [];
foreach ($attributes as $key => $attribute) {
$realAttributes[$this->routeParameterSlugify->slugify($attribute['label'])] = $attribute;
}
$node->setAttributes($realAttributes);
$urlExists = $this->nodeRepository->urlExists($generatedUrl, $node);
if ($urlExists) {
@ -151,6 +139,16 @@ class NodeEventSubscriber extends EntityManagerEventSubscriber
$node->setUrl($generatedUrl);
}
$attributes = $node->getAttributes();
$realAttributes = [];
foreach ($attributes as $key => $attribute) {
$realAttributes[$this->routeParameterSlugify->slugify($attribute['label'])] = $attribute;
}
$node->setAttributes($realAttributes);
}
public function onDelete(EntityManagerEvent $event)
{
if (!$this->support($event->getEntity())) {