|
|
|
|
|
|
|
|
use App\Entity\Merchant\Merchant; |
|
|
use App\Entity\Merchant\Merchant; |
|
|
use App\Entity\Section\Section; |
|
|
use App\Entity\Section\Section; |
|
|
use App\Entity\User\User; |
|
|
use App\Entity\User\User; |
|
|
|
|
|
use App\Entity\User\UserMerchant; |
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
use Doctrine\Persistence\ObjectManager; |
|
|
use Doctrine\Persistence\ObjectManager; |
|
|
|
|
|
|
|
|
class CaracoleFixtures extends Fixture |
|
|
class CaracoleFixtures extends Fixture |
|
|
{ |
|
|
{ |
|
|
protected $em; |
|
|
protected $em; |
|
|
public function __construct(EntityManagerInterface $entityManager){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct(EntityManagerInterface $entityManager) |
|
|
|
|
|
{ |
|
|
$this->em = $entityManager; |
|
|
$this->em = $entityManager; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function load(ObjectManager $manager) |
|
|
public function load(ObjectManager $manager) |
|
|
{ |
|
|
{ |
|
|
$fab = $this->createUserFab(); |
|
|
$fab = $this->createUserFab(); |
|
|
$gui = $this->createUserGui(); |
|
|
$gui = $this->createUserGui(); |
|
|
|
|
|
$charly = $this->createUserCharly(); |
|
|
|
|
|
|
|
|
foreach (self::$unitsArray as $unit => $unitInfos) { |
|
|
foreach (self::$unitsArray as $unit => $unitInfos) { |
|
|
$unitEntity = new Unit(); |
|
|
$unitEntity = new Unit(); |
|
|
|
|
|
|
|
|
$hubBesac->setTitle('Besançon'); |
|
|
$hubBesac->setTitle('Besançon'); |
|
|
$hubBesac->setTaxRate($taxRate2); |
|
|
$hubBesac->setTaxRate($taxRate2); |
|
|
|
|
|
|
|
|
|
|
|
$this->createUserMerchant($fab, $hubBelfort) ; |
|
|
|
|
|
$this->createUserMerchant($fab, $hubBesac) ; |
|
|
|
|
|
$this->createUserMerchant($gui, $hubBelfort) ; |
|
|
|
|
|
$this->createUserMerchant($gui, $hubBesac) ; |
|
|
|
|
|
|
|
|
$this->createSessionsBesak($hubBesac, $fab); |
|
|
$this->createSessionsBesak($hubBesac, $fab); |
|
|
$this->createSectionBelfort($hubBelfort, $fab); |
|
|
$this->createSectionBelfort($hubBelfort, $fab); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$hubBelfort->setCreatedBy($fab)->setUpdatedBy($fab)->setStatus(1); |
|
|
$hubBelfort->setCreatedBy($fab)->setUpdatedBy($fab)->setStatus(1); |
|
|
$hubBesac->setCreatedBy($fab)->setUpdatedBy($fab)->setStatus(1); |
|
|
$hubBesac->setCreatedBy($fab)->setUpdatedBy($fab)->setStatus(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->em->persist($charly); |
|
|
$this->em->persist($fab); |
|
|
$this->em->persist($fab); |
|
|
$this->em->persist($gui); |
|
|
$this->em->persist($gui); |
|
|
$this->em->persist($taxRate); |
|
|
$this->em->persist($taxRate); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function createSectionBelfort($hubBelfort, $user){ |
|
|
|
|
|
|
|
|
protected function createSectionBelfort($hubBelfort, $user) |
|
|
|
|
|
{ |
|
|
$sectionBelfort[0] = new Section(); |
|
|
$sectionBelfort[0] = new Section(); |
|
|
$sectionBelfort[0]->setTitle('Marché'); |
|
|
$sectionBelfort[0]->setTitle('Marché'); |
|
|
$sectionBelfort[0]->setStatus(1); |
|
|
$sectionBelfort[0]->setStatus(1); |
|
|
|
|
|
|
|
|
return $sectionBelfort; |
|
|
return $sectionBelfort; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected function createSessionsBesak($hubBesak, $user){ |
|
|
|
|
|
|
|
|
protected function createSessionsBesak($hubBesak, $user) |
|
|
|
|
|
{ |
|
|
$sectionBesac = new Section(); |
|
|
$sectionBesac = new Section(); |
|
|
$sectionBesac->setTitle('Marché'); |
|
|
$sectionBesac->setTitle('Marché'); |
|
|
$sectionBesac->setStatus(1); |
|
|
$sectionBesac->setStatus(1); |
|
|
|
|
|
|
|
|
return $sectionBesac; |
|
|
return $sectionBesac; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected |
|
|
|
|
|
function createUserFab() |
|
|
|
|
|
|
|
|
protected function createUserFab() |
|
|
{ |
|
|
{ |
|
|
$fab = new User(); |
|
|
$fab = new User(); |
|
|
$fab->setEmail('fab@laclic.fr'); |
|
|
$fab->setEmail('fab@laclic.fr'); |
|
|
|
|
|
|
|
|
$fab->setFirstname('Fab'); |
|
|
$fab->setFirstname('Fab'); |
|
|
$fab->setPassword('$2y$13$ExSKxXX8bQ20fBocZrUAJugov2MfE2x14BxsQaVyODsousxPWS2gS'); |
|
|
$fab->setPassword('$2y$13$ExSKxXX8bQ20fBocZrUAJugov2MfE2x14BxsQaVyODsousxPWS2gS'); |
|
|
$fab->setRoles(array('ROLE_ADMIN', 'ROLE_SUPER_ADMIN')); |
|
|
$fab->setRoles(array('ROLE_ADMIN', 'ROLE_SUPER_ADMIN')); |
|
|
|
|
|
|
|
|
return $fab; |
|
|
return $fab; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected |
|
|
|
|
|
function createUserGui() |
|
|
|
|
|
|
|
|
protected function createUserGui() |
|
|
{ |
|
|
{ |
|
|
$gui = new User(); |
|
|
$gui = new User(); |
|
|
$gui->setEmail('guillaume@laclic.fr'); |
|
|
$gui->setEmail('guillaume@laclic.fr'); |
|
|
|
|
|
|
|
|
return $gui; |
|
|
return $gui; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function createUserCharly() |
|
|
|
|
|
{ |
|
|
|
|
|
$charly = new User(); |
|
|
|
|
|
$charly->setEmail('charly@laclic.fr'); |
|
|
|
|
|
$charly->setLastname('Charly'); |
|
|
|
|
|
$charly->setFirstname('Mainier'); |
|
|
|
|
|
$charly->setPassword('$argon2id$v=19$m=65536,t=4,p=1$5eVep168MSPP4klWgyPMrQ$1qrwInxOzS5PxNML2ZmneUeNeoAeD2o6CmZhp5iMaec'); |
|
|
|
|
|
$charly->setRoles(array('ROLE_ADMIN', 'ROLE_SUPER_ADMIN')); |
|
|
|
|
|
return $charly; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function createUserMerchant($user, $merchant) |
|
|
|
|
|
{ |
|
|
|
|
|
$userMerchant = new UserMerchant() ; |
|
|
|
|
|
$userMerchant->setUser($user) ; |
|
|
|
|
|
$userMerchant->setMerchant($merchant) ; |
|
|
|
|
|
$userMerchant->setCreditActive(false) ; |
|
|
|
|
|
$userMerchant->setActive(true) ; |
|
|
|
|
|
$userMerchant->setRoles(array('ROLE_ADMIN', 'ROLE_SUPER_ADMIN')) ; |
|
|
|
|
|
$this->em->persist($userMerchant); ; |
|
|
|
|
|
return $userMerchant ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static $unitsArray = [ |
|
|
public static $unitsArray = [ |
|
|
'piece' => [ |
|
|
'piece' => [ |