DeleteAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A doExecute() 0 7 1
A setDefaultOptions() 0 6 1
A getType() 0 4 1
1
<?php
2
3
namespace Pim\Bundle\CustomEntityBundle\Action;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
9
/**
10
 * @author    Antoine Guigan <[email protected]>
11
 * @copyright 2013 Akeneo SAS (http://www.akeneo.com)
12
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
13
 */
14
class DeleteAction extends AbstractAction
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function doExecute(Request $request)
20
    {
21
        $object = $this->findEntity($request);
22
        $this->getManager()->remove($object);
23
24
        return new Response('', 204);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function setDefaultOptions(OptionsResolver $resolver)
31
    {
32
        parent::setDefaultOptions($resolver);
33
34
        $resolver->setDefaults(['route' => 'pim_customentity_delete']);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getType()
41
    {
42
        return 'delete';
43
    }
44
}
45