Code Duplication    Length = 16-18 lines in 4 locations

src/OroCRM/Bundle/CampaignBundle/Controller/EmailCampaignController.php 1 location

@@ 103-119 (lines=17) @@
100
     * @param EmailCampaign $entity
101
     * @return array
102
     */
103
    protected function update(EmailCampaign $entity)
104
    {
105
        if ($this->get('orocrm_campaign.form.handler.email_campaign')->process($entity)) {
106
            $this->get('session')->getFlashBag()->add(
107
                'success',
108
                $this->get('translator')->trans('orocrm.campaign.emailcampaign.controller.saved.message')
109
            );
110
111
            return $this->get('oro_ui.router')->redirect($entity);
112
        }
113
        $form = $this->getForm();
114
115
        return [
116
            'entity' => $entity,
117
            'form'   => $form->createView()
118
        ];
119
    }
120
121
    /**
122
     * Returns form instance

src/OroCRM/Bundle/CaseBundle/Controller/CaseController.php 1 location

@@ 94-109 (lines=16) @@
91
     * @param CaseEntity $case
92
     * @return array
93
     */
94
    protected function update(CaseEntity $case)
95
    {
96
        if ($this->get('orocrm_case.form.handler.entity')->process($case)) {
97
            $this->get('session')->getFlashBag()->add(
98
                'success',
99
                $this->get('translator')->trans('orocrm.case.message.saved')
100
            );
101
102
            return $this->get('oro_ui.router')->redirect($case);
103
        }
104
105
        return array(
106
            'entity' => $case,
107
            'form'   => $this->get('orocrm_case.form.entity')->createView()
108
        );
109
    }
110
}
111

src/OroCRM/Bundle/ContactUsBundle/Controller/ContactRequestController.php 1 location

@@ 118-135 (lines=18) @@
115
     *
116
     * @return array|\Symfony\Component\HttpFoundation\RedirectResponse
117
     */
118
    protected function update(ContactRequest $contactRequest)
119
    {
120
        $handler = $this->get('orocrm_contact_us.contact_request.form.handler');
121
122
        if ($handler->process($contactRequest)) {
123
            $this->get('session')->getFlashBag()->add(
124
                'success',
125
                $this->get('translator')->trans('orocrm.contactus.contactrequest.entity.saved')
126
            );
127
128
            return $this->get('oro_ui.router')->redirect($contactRequest);
129
        }
130
131
        return [
132
            'entity' => $contactRequest,
133
            'form'   => $handler->getForm()->createView()
134
        ];
135
    }
136
}
137

src/OroCRM/Bundle/SalesBundle/Controller/SalesFunnelController.php 1 location

@@ 102-117 (lines=16) @@
99
     * @param  SalesFunnel $entity
100
     * @return array
101
     */
102
    protected function update(SalesFunnel $entity)
103
    {
104
        if ($this->get('orocrm_sales.salesfunnel.form.handler')->process($entity)) {
105
            $this->get('session')->getFlashBag()->add(
106
                'success',
107
                $this->get('translator')->trans('orocrm.sales.controller.sales_funnel.saved.message')
108
            );
109
110
            return $this->get('oro_ui.router')->redirect($entity);
111
        }
112
113
        return array(
114
            'entity' => $entity,
115
            'form' => $this->get('orocrm_sales.salesfunnel.form')->createView(),
116
        );
117
    }
118
}
119