Skip to content

Commit 470a02c

Browse files
committed
Hydrated attribute
1 parent 4052d09 commit 470a02c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Subscription/Controller/SubscriberAttributeDefinitionController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\ORM\EntityManagerInterface;
88
use OpenApi\Attributes as OA;
99
use PhpList\Core\Domain\Subscription\Model\SubscriberAttributeDefinition;
10+
use PhpList\Core\Domain\Subscription\Repository\SubscriberAttributeDefinitionRepository;
1011
use PhpList\Core\Domain\Subscription\Service\Manager\AttributeDefinitionManager;
1112
use PhpList\Core\Security\Authentication;
1213
use PhpList\RestBundle\Common\Controller\BaseController;
@@ -343,6 +344,13 @@ public function getAttributeDefinition(
343344
throw $this->createNotFoundException('Attribute definition not found.');
344345
}
345346

347+
/** @var SubscriberAttributeDefinitionRepository $repo */
348+
$repo = $this->entityManager->getRepository(SubscriberAttributeDefinition::class);
349+
$hydrated = $repo->findOneByName($attributeDefinition->getName());
350+
if ($hydrated instanceof SubscriberAttributeDefinition) {
351+
$attributeDefinition = $hydrated;
352+
}
353+
346354
return $this->json(
347355
$this->normalizer->normalize($attributeDefinition),
348356
Response::HTTP_OK

0 commit comments

Comments
 (0)