Skip to content

Commit 4657ac2

Browse files
committed
Flush in controller
1 parent c68921c commit 4657ac2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Identity/Controller/AdminAttributeValueController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace PhpList\RestBundle\Identity\Controller;
66

7+
use Doctrine\ORM\EntityManagerInterface;
78
use OpenApi\Attributes as OA;
89
use PhpList\Core\Domain\Identity\Model\Filter\AdminAttributeValueFilter;
910
use PhpList\Core\Domain\Identity\Model\Administrator;
@@ -27,18 +28,21 @@ class AdminAttributeValueController extends BaseController
2728
private AdminAttributeManager $attributeManager;
2829
private AdminAttributeValueNormalizer $normalizer;
2930
private PaginatedDataProvider $paginatedDataProvider;
31+
private EntityManagerInterface $entityManager;
3032

3133
public function __construct(
3234
Authentication $authentication,
3335
RequestValidator $validator,
3436
AdminAttributeManager $attributeManager,
3537
AdminAttributeValueNormalizer $normalizer,
36-
PaginatedDataProvider $paginatedDataProvider
38+
PaginatedDataProvider $paginatedDataProvider,
39+
EntityManagerInterface $entityManager,
3740
) {
3841
parent::__construct($authentication, $validator);
3942
$this->attributeManager = $attributeManager;
4043
$this->normalizer = $normalizer;
4144
$this->paginatedDataProvider = $paginatedDataProvider;
45+
$this->entityManager = $entityManager;
4246
}
4347

4448
#[Route(
@@ -122,6 +126,7 @@ public function createOrUpdate(
122126
definition: $definition,
123127
value: $request->toArray()['value'] ?? null
124128
);
129+
$this->entityManager->flush();
125130
$json = $this->normalizer->normalize($attributeDefinition, 'json');
126131

127132
return $this->json($json, Response::HTTP_CREATED);

0 commit comments

Comments
 (0)