Completed
Push — master ( 2ea0dc...0826f5 )
by Jan
04:38 queued 01:31
created

ManufacturerController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 56
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A exportEntity() 0 3 1
A new() 0 3 1
A exportAll() 0 3 1
A delete() 0 3 1
A edit() 0 3 1
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\AdminPages;
33
34
35
use App\Entity\AttachmentType;
36
37
use App\Entity\Manufacturer;
38
use App\Entity\Supplier;
39
use App\Form\BaseEntityAdminForm;
40
use App\Form\CompanyForm;
41
use App\Services\EntityExporter;
42
use App\Services\EntityImporter;
43
use App\Services\StructuralElementRecursionHelper;
44
use Doctrine\ORM\EntityManagerInterface;
45
use Symfony\Component\HttpFoundation\Request;
46
use Symfony\Component\HttpFoundation\Response;
47
use Symfony\Component\Routing\Annotation\Route;
48
use Symfony\Component\Serializer\SerializerInterface;
49
50
/**
51
 * @Route("/manufacturer")
52
 * @package App\Controller
53
 */
54
class ManufacturerController extends BaseAdminController
55
{
56
57
    protected $entity_class = Manufacturer::class;
58
    protected $twig_template = 'AdminPages/ManufacturerAdmin.html.twig';
59
    protected $form_class = CompanyForm::class;
60
    protected $route_base = 'manufacturer';
61
62
    /**
63
     * @Route("/{id}/edit", requirements={"id"="\d+"}, name="manufacturer_edit")
64
     * @Route("/{id}/", requirements={"id"="\d+"})
65
     */
66
    public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em)
67
    {
68
        return $this->_edit($entity, $request, $em);
69
    }
70
71
    /**
72
     * @Route("/new", name="manufacturer_new")
73
     * @Route("/")
74
     *
75
     * @return \Symfony\Component\HttpFoundation\Response
76
     */
77
    public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
78
    {
79
        return $this->_new($request, $em, $importer);
80
    }
81
82
    /**
83
     * @Route("/{id}", name="manufacturer_delete", methods={"DELETE"})
84
     */
85
    public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper)
86
    {
87
        return $this->_delete($request, $entity, $recursionHelper);
88
    }
89
90
    /**
91
     * @Route("/export", name="manufacturer_export_all")
92
     * @param Request $request
93
     * @param SerializerInterface $serializer
94
     * @param EntityManagerInterface $em
95
     * @return Response
96
     */
97
    public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
98
    {
99
        return $this->_exportAll($em, $exporter, $request);
100
    }
101
102
    /**
103
     * @Route("/{id}/export", name="manufacturer_export")
104
     * @param Request $request
105
     * @param Supplier $entity
106
     */
107
    public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request)
108
    {
109
        return $this->_exportEntity($entity, $exporter, $request);
110
    }
111
112
}