Skip to content

Commit

Permalink
Merge branch hotfix/v2.3.20
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Jul 13, 2024
1 parent 3e8d4dd commit 5bf316c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
parameters:
roadiz_core.cms_version: '2.3.19'
roadiz_core.cms_version: '2.3.20'
roadiz_core.cms_version_prefix: 'main'
env(APP_NAMESPACE): "roadiz"
env(APP_VERSION): "0.1.0"
Expand Down
14 changes: 12 additions & 2 deletions src/Doctrine/EventSubscriber/NodesSourcesInheritanceSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Psr\Log\LoggerInterface;
use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface;
use RZ\Roadiz\CoreBundle\Bag\NodeTypes;
use RZ\Roadiz\CoreBundle\DependencyInjection\Configuration;
Expand All @@ -19,7 +20,8 @@ final class NodesSourcesInheritanceSubscriber implements EventSubscriber
{
public function __construct(
private readonly NodeTypes $nodeTypes,
private readonly string $inheritanceType
private readonly string $inheritanceType,
private readonly LoggerInterface $logger
) {
}

Expand Down Expand Up @@ -59,7 +61,15 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
$nodeTypes = $this->nodeTypes->all();
$map = [];
foreach ($nodeTypes as $type) {
$map[\mb_strtolower($type->getName())] = $type->getSourceEntityFullQualifiedClassName();
if (\class_exists($type->getSourceEntityFullQualifiedClassName())) {
$map[\mb_strtolower($type->getName())] = $type->getSourceEntityFullQualifiedClassName();
} else {
$this->logger->critical(sprintf(
'"%s" node-type is registered in database but source entity class "%s" does not exist.',
$type->getName(),
$type->getSourceEntityFullQualifiedClassName()
));
}
}
$metadata->setDiscriminatorMap($map);

Expand Down

0 comments on commit 5bf316c

Please sign in to comment.