Completed
Pull Request — master (#58)
by Laurent
03:26
created

TvaController::createAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
c 6
b 0
f 1
dl 11
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
/**
3
 * TvaController controller des taux de T.V.A.
4
 *
5
 * PHP Version 5
6
 *
7
 * @author    Quétier Laurent <[email protected]>
8
 * @copyright 2014 Dev-Int GLSR
9
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
10
 *
11
 * @version   since 1.0.0
12
 *
13
 * @link      https://github.com/Dev-Int/glsr
14
 */
15
namespace AppBundle\Controller\Settings\Divers;
16
17
use Symfony\Component\HttpFoundation\Request;
18
use AppBundle\Controller\AbstractController;
19
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
20
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
21
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
22
use AppBundle\Entity\Tva;
23
24
/**
25
 * Tva controller.
26
 *
27
 * @category Controller
28
 *
29
 * @Route("/admin/settings/divers/tva")
30
 */
31 View Code Duplication
class TvaController extends AbstractController
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
{
33
    /**
34
     * Lists all Tva entities.
35
     *
36
     * @Route("/", name="tva")
37
     * @Method("GET")
38
     * @Template()
39
     */
40
    public function indexAction()
41
    {
42
        $return = $this->abstractIndexAction('Tva');
43
44
        return $return;
45
    }
46
47
    /**
48
     * Finds and displays a Tva entity.
49
     *
50
     * @Route("/{id}/show", name="tva_show", requirements={"id"="\d+"})
51
     * @Method("GET")
52
     * @Template()
53
     */
54
    public function showAction(Tva $tva)
55
    {
56
        $return = $this->abstractShowAction($tva, 'tva');
57
58
        return $return;
59
    }
60
61
    /**
62
     * Displays a form to create a new Tva entity.
63
     *
64
     * @Route("/new", name="tva_new")
65
     * @Method("GET")
66
     * @Template()
67
     */
68
    public function newAction()
69
    {
70
        $return = $this->abstractNewAction(
71
            'Tva',
72
            'AppBundle\Entity\Tva',
73
            'AppBundle\Form\Type\TvaType'
74
        );
75
76
        return $return;
77
    }
78
79
    /**
80
     * Creates a new Tva entity.
81
     *
82
     * @Route("/create", name="tva_create")
83
     * @Method("POST")
84
     * @Template("AppBundle:Tva:new.html.twig")
85
     */
86
    public function createAction(Request $request)
87
    {
88
        $return = $this->abstractCreateAction(
89
            $request,
90
            'tva',
91
            'AppBundle\Entity\Tva',
92
            'AppBundle\Form\Type\TvaType'
93
        );
94
95
        return $return;
96
    }
97
98
    /**
99
     * Displays a form to edit an existing Tva entity.
100
     *
101
     * @Route("/{id}/edit", name="tva_edit", requirements={"id"="\d+"})
102
     * @Method("GET")
103
     * @Template()
104
     */
105
    public function editAction(Tva $tva)
106
    {
107
        $return = $this->abstractEditAction($tva, 'tva', 'AppBundle\Form\Type\TvaType');
108
109
        return $return;
110
    }
111
112
    /**
113
     * Edits an existing Tva entity.
114
     *
115
     * @Route("/{id}/update", name="tva_update", requirements={"id"="\d+"})
116
     * @Method("PUT")
117
     * @Template("AppBundle:Tva:edit.html.twig")
118
     */
119
    public function updateAction(Tva $tva, Request $request)
120
    {
121
        $return = $this->abstractUpdateAction($tva, $request, 'tva', 'AppBundle\Form\Type\TvaType');
122
123
        return $return;
124
    }
125
126
    /**
127
     * Deletes a Tva entity.
128
     *
129
     * @Route("/{id}/delete", name="tva_delete", requirements={"id"="\d+"})
130
     * @Method("DELETE")
131
     */
132
    public function deleteAction(Tva $tva, Request $request)
133
    {
134
        $this->abstractDeleteAction($tva, $request, 'tva');
135
136
        return $this->redirectToRoute('tva');
137
    }
138
}
139