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