Code Duplication    Length = 10-10 lines in 2 locations

Controller/RestController.php 2 locations

@@ 154-163 (lines=10) @@
151
        $this->eventDispatcher->dispatch(RestEvents::POST_ACTION_PRE_SUBMIT, new PostFormEvent($form, $request));
152
        $form->submit($request->request->all());
153
154
        if ($form->isValid()) {
155
            $entity = $form->getData();
156
            $this->eventDispatcher->dispatch(RestEvents::POST_ACTION_POST_VALIDATION, new GenericEvent($entity));
157
            $this->restManager->getManager()->persist($entity, true);
158
            $this->eventDispatcher->dispatch(RestEvents::POST_ACTION_POST_PERSIST, new GenericEvent($entity));
159
160
            return $this->handleWithGroups($entity, [
161
                $this->getSerializationGroup('post'),
162
            ]);
163
        }
164
165
        $this->eventDispatcher->dispatch(RestEvents::POST_ACTION_VALIDATION_ERROR, new PostFormEvent($form, $request));
166
@@ 187-196 (lines=10) @@
184
        $this->eventDispatcher->dispatch(RestEvents::PUT_ACTION_PRE_SUBMIT, new PutFormEvent($form, $request));
185
        $form->submit($request->request->all());
186
187
        if ($form->isValid()) {
188
            $entity = $form->getData();
189
            $this->eventDispatcher->dispatch(RestEvents::PUT_ACTION_POST_VALIDATION, new GenericEvent($entity));
190
            $this->restManager->getManager()->merge($entity, true);
191
            $this->eventDispatcher->dispatch(RestEvents::PUT_ACTION_POST_PERSIST, new GenericEvent($entity));
192
193
            return $this->handleWithGroups($entity, [
194
                $this->getSerializationGroup('put'),
195
            ]);
196
        }
197
198
        $this->eventDispatcher->dispatch(RestEvents::PUT_ACTION_VALIDATION_ERROR, new PutFormEvent($form, $request));
199