Completed
Push — master ( 87e6f6...568367 )
by Jan
04:10
created

CurrencyController::edit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 3
rs 10
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\Attachments\AttachmentType;
36
use App\Entity\Parts\Category;
37
use App\Entity\PriceInformations\Currency;
38
use App\Form\AdminPages\BaseEntityAdminForm;
39
use App\Form\AdminPages\CategoryAdminForm;
40
use App\Form\AdminPages\CurrencyAdminForm;
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("/currency")
52
 *
53
 * Class CurrencyController
54
 * @package App\Controller\AdminPages
55
 */
56
class CurrencyController extends BaseAdminController
57
{
58
    protected $entity_class = Currency::class;
59
    protected $twig_template = 'AdminPages/CurrencyAdmin.html.twig';
60
    protected $form_class = CurrencyAdminForm::class;
61
    protected $route_base = "currency";
62
63
    /**
64
     * @Route("/{id}/edit", requirements={"id"="\d+"}, name="currency_edit")
65
     * @Route("/{id}/", requirements={"id"="\d+"})
66
     */
67
    public function edit(Currency $entity, Request $request, EntityManagerInterface $em)
68
    {
69
        return $this->_edit($entity, $request, $em);
70
    }
71
72
    /**
73
     * @Route("/new", name="currency_new")
74
     * @Route("/")
75
     *
76
     * @return \Symfony\Component\HttpFoundation\Response
77
     */
78
    public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer)
79
    {
80
        return $this->_new($request, $em, $importer);
81
    }
82
83
    /**
84
     * @Route("/{id}", name="currency_delete", methods={"DELETE"})
85
     */
86
    public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper)
87
    {
88
        return $this->_delete($request, $entity, $recursionHelper);
89
    }
90
91
    /**
92
     * @Route("/export", name="currency_export_all")
93
     * @param Request $request
94
     * @param SerializerInterface $serializer
95
     * @param EntityManagerInterface $em
96
     * @return Response
97
     */
98
    public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request)
99
    {
100
        return $this->_exportAll($em, $exporter, $request);
101
    }
102
103
    /**
104
     * @Route("/{id}/export", name="currency_export")
105
     * @param Request $request
106
     * @param AttachmentType $entity
107
     */
108
    public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request)
109
    {
110
        return $this->_exportEntity($entity, $exporter, $request);
111
    }
112
}