|
4 | 4 |
|
5 | 5 | namespace PhpList\RestBundle\Subscription\Controller; |
6 | 6 |
|
| 7 | +use Doctrine\ORM\EntityManagerInterface; |
7 | 8 | use OpenApi\Attributes as OA; |
8 | 9 | use PhpList\Core\Domain\Subscription\Model\Filter\SubscriberAttributeValueFilter; |
9 | 10 | use PhpList\Core\Domain\Subscription\Model\Subscriber; |
@@ -33,7 +34,8 @@ public function __construct( |
33 | 34 | RequestValidator $validator, |
34 | 35 | SubscriberAttributeManager $attributeManager, |
35 | 36 | SubscriberAttributeValueNormalizer $normalizer, |
36 | | - PaginatedDataProvider $paginatedDataProvider |
| 37 | + PaginatedDataProvider $paginatedDataProvider, |
| 38 | + private readonly EntityManagerInterface $entityManager, |
37 | 39 | ) { |
38 | 40 | parent::__construct($authentication, $validator); |
39 | 41 | $this->attributeManager = $attributeManager; |
@@ -193,6 +195,7 @@ public function delete( |
193 | 195 | throw $this->createNotFoundException('Subscriber attribute not found.'); |
194 | 196 | } |
195 | 197 | $this->attributeManager->delete($attribute); |
| 198 | + $this->entityManager->flush(); |
196 | 199 |
|
197 | 200 | return $this->json(null, Response::HTTP_NO_CONTENT); |
198 | 201 | } |
@@ -349,6 +352,7 @@ public function getAttributeDefinition( |
349 | 352 | } |
350 | 353 | $attribute = $this->attributeManager->getSubscriberAttribute($subscriber->getId(), $definition->getId()); |
351 | 354 | $this->attributeManager->delete($attribute); |
| 355 | + $this->entityManager->flush(); |
352 | 356 |
|
353 | 357 | return $this->json( |
354 | 358 | $this->normalizer->normalize($attribute), |
|
0 commit comments