@@ -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 | } |
@@ -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 | } |
@@ -47,8 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function persist(&$entity) |
| 49 | 49 | { |
| 50 | - if (self::$persisted == true) |
|
| 51 | - return; |
|
| 50 | + if (self::$persisted == true) { |
|
| 51 | + return; |
|
| 52 | + } |
|
| 52 | 53 | self::$persisted = true; |
| 53 | 54 | |
| 54 | 55 | //$this->manager->persist($entity); |
@@ -67,15 +68,17 @@ discard block |
||
| 67 | 68 | } else { |
| 68 | 69 | $json = json_decode($this->request->getContent(), true); |
| 69 | 70 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
| 70 | - if (!$extra_data) |
|
| 71 | - return; |
|
| 71 | + if (!$extra_data) { |
|
| 72 | + return; |
|
| 73 | + } |
|
| 72 | 74 | $entity_id = $extra_data['entity_id']; |
| 73 | 75 | $entity_name = $extra_data['entity_name']; |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | 78 | |
| 77 | - if (!$entity_id || !$entity_name) |
|
| 78 | - return; |
|
| 79 | + if (!$entity_id || !$entity_name) { |
|
| 80 | + return; |
|
| 81 | + } |
|
| 79 | 82 | |
| 80 | 83 | foreach ($extra_data['data'] as $key => $data) { |
| 81 | 84 | $extra_fields = $this->manager->getRepository(ExtraFields::class)->find($key); |
@@ -86,8 +89,9 @@ discard block |
||
| 86 | 89 | 'extra_fields' => $extra_fields |
| 87 | 90 | ]); |
| 88 | 91 | |
| 89 | - if (!$extraData) |
|
| 90 | - $extraData = new ExtraData(); |
|
| 92 | + if (!$extraData) { |
|
| 93 | + $extraData = new ExtraData(); |
|
| 94 | + } |
|
| 91 | 95 | |
| 92 | 96 | $extraData->setExtraFields($extra_fields); |
| 93 | 97 | $extraData->setEntityName($entity_name); |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | //$this->manager->persist($entity); |
| 66 | 66 | } else { |
| 67 | - $json = json_decode($this->request->getContent(), true); |
|
| 67 | + $json = json_decode($this->request->getContent(), true); |
|
| 68 | 68 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
| 69 | 69 | if (!$extra_data) |
| 70 | 70 | return; |