|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics) |
|
6
|
|
|
* |
|
7
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
8
|
|
|
* it under the terms of the GNU Affero General Public License as published |
|
9
|
|
|
* by the Free Software Foundation, either version 3 of the License, or |
|
10
|
|
|
* (at your option) any later version. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace App\DataFixtures; |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
use App\Entity\LabelSystem\LabelOptions; |
|
25
|
|
|
use App\Entity\LabelSystem\LabelProfile; |
|
26
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
|
27
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
28
|
|
|
use Doctrine\Persistence\ObjectManager; |
|
29
|
|
|
|
|
30
|
|
|
class LabelProfileFixtures extends Fixture |
|
31
|
|
|
{ |
|
32
|
|
|
|
|
33
|
|
|
protected $em; |
|
34
|
|
|
|
|
35
|
|
|
public function __construct(EntityManagerInterface $entityManager) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->em = $entityManager; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function load(ObjectManager $manager) |
|
41
|
|
|
{ |
|
42
|
|
|
$this->em->getConnection()->exec("ALTER TABLE `label_profiles` AUTO_INCREMENT = 1;"); |
|
43
|
|
|
|
|
44
|
|
|
$profile1 = new LabelProfile(); |
|
45
|
|
|
$profile1->setName('Profile 1'); |
|
46
|
|
|
$profile1->setShowInDropdown(true); |
|
47
|
|
|
|
|
48
|
|
|
$option1 = new LabelOptions(); |
|
49
|
|
|
$option1->setLines("[[NAME]]\n[[DESCRIPION]]"); |
|
50
|
|
|
$option1->setBarcodeType('none'); |
|
51
|
|
|
$option1->setSupportedElement('part'); |
|
52
|
|
|
$profile1->setOptions($option1); |
|
53
|
|
|
|
|
54
|
|
|
$manager->persist($profile1); |
|
55
|
|
|
|
|
56
|
|
|
$profile2 = new LabelProfile(); |
|
57
|
|
|
$profile2->setName('Profile 2'); |
|
58
|
|
|
$profile2->setShowInDropdown(false); |
|
59
|
|
|
|
|
60
|
|
|
$option2 = new LabelOptions(); |
|
61
|
|
|
$option2->setLines("[[NAME]]\n[[DESCRIPION]]"); |
|
62
|
|
|
$option2->setBarcodeType('qr'); |
|
63
|
|
|
$option2->setSupportedElement('part'); |
|
64
|
|
|
$profile2->setOptions($option2); |
|
65
|
|
|
|
|
66
|
|
|
$manager->persist($profile2); |
|
67
|
|
|
|
|
68
|
|
|
$profile3 = new LabelProfile(); |
|
69
|
|
|
$profile3->setName('Profile 3'); |
|
70
|
|
|
$profile3->setShowInDropdown(true); |
|
71
|
|
|
|
|
72
|
|
|
$option3 = new LabelOptions(); |
|
73
|
|
|
$option3->setLines("[[NAME]]\n[[DESCRIPION]]"); |
|
74
|
|
|
$option3->setBarcodeType('code128'); |
|
75
|
|
|
$option3->setSupportedElement('part_lot'); |
|
76
|
|
|
$profile3->setOptions($option3); |
|
77
|
|
|
|
|
78
|
|
|
$manager->persist($profile3); |
|
79
|
|
|
|
|
80
|
|
|
|
|
81
|
|
|
$profile4 = new LabelProfile(); |
|
82
|
|
|
$profile4->setName('Profile 4'); |
|
83
|
|
|
$profile4->setShowInDropdown(true); |
|
84
|
|
|
|
|
85
|
|
|
$option4 = new LabelOptions(); |
|
86
|
|
|
$option4->setLines("{{ element.name }}"); |
|
87
|
|
|
$option4->setBarcodeType('code39'); |
|
88
|
|
|
$option4->setSupportedElement('part'); |
|
89
|
|
|
$option4->setLinesMode('twig'); |
|
90
|
|
|
$profile4->setOptions($option4); |
|
91
|
|
|
|
|
92
|
|
|
$manager->persist($profile4); |
|
93
|
|
|
|
|
94
|
|
|
$manager->flush(); |
|
95
|
|
|
} |
|
96
|
|
|
} |