DeleteAction::getType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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