Completed
Push — master ( 220d60...424407 )
by Jan
03:10
created

AttachmentTypeController::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 * part-db version 0.1
5
 * Copyright (C) 2005 Christoph Lechner
6
 * http://www.cl-projects.de/
7
 *
8
 * part-db version 0.2+
9
 * Copyright (C) 2009 K. Jacobs and others (see authors.php)
10
 * http://code.google.com/p/part-db/
11
 *
12
 * Part-DB Version 0.4+
13
 * Copyright (C) 2016 - 2019 Jan Böhmer
14
 * https://github.com/jbtronics
15
 *
16
 * This program is free software; you can redistribute it and/or
17
 * modify it under the terms of the GNU General Public License
18
 * as published by the Free Software Foundation; either version 2
19
 * of the License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
29
 *
30
 */
31
32
namespace App\Controller;
33
34
35
use App\Entity\AttachmentType;
36
37
use App\Form\BaseEntityAdminForm;
38
use App\Services\EntityExporter;
39
use App\Services\EntityImporter;
40
use App\Services\StructuralElementRecursionHelper;
41
use Doctrine\ORM\EntityManagerInterface;
42
use Symfony\Component\HttpFoundation\Request;
43
use Symfony\Component\HttpFoundation\Response;
44
use Symfony\Component\Routing\Annotation\Route;
45
use Symfony\Component\Serializer\SerializerInterface;
46
47
/**
48
 * @Route("/attachment_type")
49
 * @package App\Controller
50
 */
51
class AttachmentTypeController extends BaseAdminController
52
{
53
54
    protected $entity_class = AttachmentType::class;
55
    protected $twig_template = 'AdminPages/AttachmentTypeAdmin.html.twig';
56
    protected $form_class = BaseEntityAdminForm::class;
57
    protected $route_base = "attachment_type";
58
59
    /**
60
     * @Route("/{id}/edit", requirements={"id"="\d+"}, name="attachment_type_edit")
61
     * @Route("/{id}/", requirements={"id"="\d+"})
62
     */
63
    public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em)
64
    {
65
        return $this->_edit($entity, $request, $em);
66
    }
67
68
    /**
69
     * @Route("/new", name="attachment_type_new")
70
     * @Route("/")
71
     *
72
     * @return \Symfony\Component\HttpFoundation\Response
73
     */
74
    public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
75
    {
76
        return $this->_new($request, $em, $importer);
77
    }
78
79
    /**
80
     * @Route("/{id}", name="attachment_type_delete", methods={"DELETE"})
81
     */
82
    public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper)
83
    {
84
        return $this->_delete($request, $entity, $recursionHelper);
85
    }
86
87
    /**
88
     * @Route("/export", name="attachment_type_export_all")
89
     * @param Request $request
90
     * @param SerializerInterface $serializer
91
     * @param EntityManagerInterface $em
92
     * @return Response
93
     */
94
    public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
95
    {
96
        return $this->_exportAll($em, $exporter, $request);
97
    }
98
99
    /**
100
     * @Route("/{id}/export", name="attachment_type_export")
101
     * @param Request $request
102
     * @param AttachmentType $entity
103
     */
104
    public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request)
105
    {
106
        return $this->_exportEntity($entity, $exporter, $request);
107
    }
108
109
}