@@ -51,8 +51,9 @@ |
||
| 51 | 51 | $service = $this->container->get($serviceName); |
| 52 | 52 | if (method_exists($service, $method)) { |
| 53 | 53 | $entity = $service->$method($entity); |
| 54 | - if ('postPersist' === $method && $entity) |
|
| 55 | - $this->manager->refresh($entity); |
|
| 54 | + if ('postPersist' === $method && $entity) { |
|
| 55 | + $this->manager->refresh($entity); |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | } |
| 58 | 59 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | private function persistData($entity = null) |
| 61 | 61 | { |
| 62 | 62 | |
| 63 | - $json = json_decode($this->request->getContent(), true); |
|
| 63 | + $json = json_decode($this->request->getContent(), true); |
|
| 64 | 64 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
| 65 | 65 | |
| 66 | 66 | if (!$extra_data) |
@@ -49,8 +49,9 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function persist($entity) |
| 51 | 51 | { |
| 52 | - if (self::$persisted == true) |
|
| 53 | - return; |
|
| 52 | + if (self::$persisted == true) { |
|
| 53 | + return; |
|
| 54 | + } |
|
| 54 | 55 | self::$persisted = true; |
| 55 | 56 | |
| 56 | 57 | //$this->manager->persist($entity); |
@@ -63,8 +64,9 @@ discard block |
||
| 63 | 64 | $json = json_decode($this->request->getContent(), true); |
| 64 | 65 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
| 65 | 66 | |
| 66 | - if (!$extra_data) |
|
| 67 | - return; |
|
| 67 | + if (!$extra_data) { |
|
| 68 | + return; |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | if ($entity) { |
| 70 | 72 | $entity_id = $entity->getId(); |
@@ -77,8 +79,9 @@ discard block |
||
| 77 | 79 | } |
| 78 | 80 | |
| 79 | 81 | |
| 80 | - if (!$entity_id || !$entity_name) |
|
| 81 | - return; |
|
| 82 | + if (!$entity_id || !$entity_name) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 82 | 85 | |
| 83 | 86 | foreach ($extra_data['data'] as $key => $data) { |
| 84 | 87 | $extra_fields = $this->manager->getRepository(ExtraFields::class)->find($key); |
@@ -89,8 +92,9 @@ discard block |
||
| 89 | 92 | 'extra_fields' => $extra_fields |
| 90 | 93 | ]); |
| 91 | 94 | |
| 92 | - if (!$extraData) |
|
| 93 | - $extraData = new ExtraData(); |
|
| 95 | + if (!$extraData) { |
|
| 96 | + $extraData = new ExtraData(); |
|
| 97 | + } |
|
| 94 | 98 | |
| 95 | 99 | $extraData->setExtraFields($extra_fields); |
| 96 | 100 | $extraData->setEntityName($entity_name); |
@@ -105,8 +109,9 @@ discard block |
||
| 105 | 109 | |
| 106 | 110 | public function noChange() |
| 107 | 111 | { |
| 108 | - if (self::$persisted == true) |
|
| 109 | - return; |
|
| 112 | + if (self::$persisted == true) { |
|
| 113 | + return; |
|
| 114 | + } |
|
| 110 | 115 | $this->persistData(); |
| 111 | 116 | } |
| 112 | 117 | } |
@@ -10,16 +10,16 @@ |
||
| 10 | 10 | class NotificationService |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - public function __construct( |
|
| 13 | + public function __construct( |
|
| 14 | 14 | private EntityManagerInterface $manager, |
| 15 | 15 | private Security $security, |
| 16 | 16 | private RequestStack $requestStack, |
| 17 | 17 | private PusherService $pusher |
| 18 | - ) { |
|
| 19 | - } |
|
| 18 | + ) { |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function postPersist(Notification $notification) |
|
| 22 | - { |
|
| 21 | + public function postPersist(Notification $notification) |
|
| 22 | + { |
|
| 23 | 23 | $this->pusher->push(['company' => 1, 'people' => 1], 'my_topic'); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | } |