44
55namespace PhpList \RestBundle \Identity \Controller ;
66
7+ use Doctrine \ORM \EntityManagerInterface ;
78use OpenApi \Attributes as OA ;
89use PhpList \Core \Domain \Identity \Model \Filter \AdminAttributeValueFilter ;
910use 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