. */ namespace App\DataFixtures; use App\Entity\LabelSystem\LabelOptions; use App\Entity\LabelSystem\LabelProfile; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ObjectManager; class LabelProfileFixtures extends Fixture { protected $em; public function __construct(EntityManagerInterface $entityManager) { $this->em = $entityManager; } public function load(ObjectManager $manager) { $this->em->getConnection()->exec("ALTER TABLE `label_profiles` AUTO_INCREMENT = 1;"); $profile1 = new LabelProfile(); $profile1->setName('Profile 1'); $profile1->setShowInDropdown(true); $option1 = new LabelOptions(); $option1->setLines("[[NAME]]\n[[DESCRIPION]]"); $option1->setBarcodeType('none'); $option1->setSupportedElement('part'); $profile1->setOptions($option1); $manager->persist($profile1); $profile2 = new LabelProfile(); $profile2->setName('Profile 2'); $profile2->setShowInDropdown(false); $option2 = new LabelOptions(); $option2->setLines("[[NAME]]\n[[DESCRIPION]]"); $option2->setBarcodeType('qr'); $option2->setSupportedElement('part'); $profile2->setOptions($option2); $manager->persist($profile2); $profile3 = new LabelProfile(); $profile3->setName('Profile 3'); $profile3->setShowInDropdown(true); $option3 = new LabelOptions(); $option3->setLines("[[NAME]]\n[[DESCRIPION]]"); $option3->setBarcodeType('code128'); $option3->setSupportedElement('part_lot'); $profile3->setOptions($option3); $manager->persist($profile3); $profile4 = new LabelProfile(); $profile4->setName('Profile 4'); $profile4->setShowInDropdown(true); $option4 = new LabelOptions(); $option4->setLines("{{ element.name }}"); $option4->setBarcodeType('code39'); $option4->setSupportedElement('part'); $option4->setLinesMode('twig'); $profile4->setOptions($option4); $manager->persist($profile4); $manager->flush(); } }