Code Duplication    Length = 22-23 lines in 2 locations

src/OroCRM/Bundle/CallBundle/Controller/CallController.php 1 location

@@ 160-182 (lines=23) @@
157
     *
158
     * @return array
159
     */
160
    protected function update(Call $entity, $formAction)
161
    {
162
        $saved = false;
163
164
        if ($this->get('orocrm_call.call.form.handler')->process($entity)) {
165
            if (!$this->getRequest()->get('_widgetContainer')) {
166
                $this->get('session')->getFlashBag()->add(
167
                    'success',
168
                    $this->get('translator')->trans('orocrm.call.controller.call.saved.message')
169
                );
170
171
                return $this->get('oro_ui.router')->redirect($entity);
172
            }
173
            $saved = true;
174
        }
175
176
        return array(
177
            'entity'     => $entity,
178
            'saved'      => $saved,
179
            'form'       => $this->get('orocrm_call.call.form.handler')->getForm()->createView(),
180
            'formAction' => $formAction
181
        );
182
    }
183
184
    /**
185
     * Get target entity

src/OroCRM/Bundle/TaskBundle/Controller/TaskController.php 1 location

@@ 181-202 (lines=22) @@
178
     * @param string $formAction
179
     * @return array
180
     */
181
    protected function update(Task $task, $formAction)
182
    {
183
        $saved = false;
184
        if ($this->get('orocrm_task.form.handler.task')->process($task)) {
185
            if (!$this->getRequest()->get('_widgetContainer')) {
186
                $this->get('session')->getFlashBag()->add(
187
                    'success',
188
                    $this->get('translator')->trans('orocrm.task.saved_message')
189
                );
190
191
                return $this->get('oro_ui.router')->redirect($task);
192
            }
193
            $saved = true;
194
        }
195
196
        return array(
197
            'entity'     => $task,
198
            'saved'      => $saved,
199
            'form'       => $this->get('orocrm_task.form.handler.task')->getForm()->createView(),
200
            'formAction' => $formAction,
201
        );
202
    }
203
204
    /**
205
     * @return TaskType