Completed
Push — master ( 487c78...defd16 )
by Jan
03:27
created

StorelocationController::exportAll()   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\Entity\Storelocation;
38
use App\Form\BaseEntityAdminForm;
39
use App\Form\StorelocationAdminForm;
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\HttpKernel\HttpCache\Store;
47
use Symfony\Component\Routing\Annotation\Route;
48
use Symfony\Component\Serializer\SerializerInterface;
49
50
/**
51
 * @Route("/store_location")
52
 * @package App\Controller
53
 */
54
class StorelocationController extends BaseAdminController
55
{
56
57
    protected $entity_class = Storelocation::class;
58
    protected $twig_template = 'AdminPages/StorelocationAdmin.html.twig';
59
    protected $form_class = StorelocationAdminForm::class;
60
    protected $route_base = "store_location";
61
62
    /**
63
     * @Route("/{id}/edit", requirements={"id"="\d+"}, name="store_location_edit")
64
     * @Route("/{id}/", requirements={"id"="\d+"})
65
     */
66
    public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em)
67
    {
68
        return $this->_edit($entity, $request, $em);
69
    }
70
71
    /**
72
     * @Route("/new", name="store_location_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="store_location_delete", methods={"DELETE"})
84
     */
85
    public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper)
86
    {
87
        return $this->_delete($request, $entity, $recursionHelper);
88
    }
89
90
    /**
91
     * @Route("/export", name="store_location_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="store_location_export")
104
     * @param Request $request
105
     * @param AttachmentType $entity
106
     */
107
    public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request)
108
    {
109
        return $this->_exportEntity($entity, $exporter, $request);
110
    }
111
112
}