|
|
@@ -11,6 +11,7 @@ use App\Entity\Config\Unit; |
|
|
|
use App\Entity\Merchant\Merchant; |
|
|
|
use App\Entity\Section\Section; |
|
|
|
use App\Entity\User\User; |
|
|
|
use App\Entity\User\UserMerchant; |
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
use Doctrine\Persistence\ObjectManager; |
|
|
@@ -19,13 +20,17 @@ use Lc\SovBundle\Model\User\UserInterface; |
|
|
|
class CaracoleFixtures extends Fixture |
|
|
|
{ |
|
|
|
protected $em; |
|
|
|
public function __construct(EntityManagerInterface $entityManager){ |
|
|
|
|
|
|
|
public function __construct(EntityManagerInterface $entityManager) |
|
|
|
{ |
|
|
|
$this->em = $entityManager; |
|
|
|
} |
|
|
|
|
|
|
|
public function load(ObjectManager $manager) |
|
|
|
{ |
|
|
|
$fab = $this->createUserFab(); |
|
|
|
$gui = $this->createUserGui(); |
|
|
|
$charly = $this->createUserCharly(); |
|
|
|
|
|
|
|
foreach (self::$unitsArray as $unit => $unitInfos) { |
|
|
|
$unitEntity = new Unit(); |
|
|
@@ -68,6 +73,11 @@ class CaracoleFixtures extends Fixture |
|
|
|
$hubBesac->setTitle('Besançon'); |
|
|
|
$hubBesac->setTaxRate($taxRate2); |
|
|
|
|
|
|
|
$this->createUserMerchant($fab, $hubBelfort) ; |
|
|
|
$this->createUserMerchant($fab, $hubBesac) ; |
|
|
|
$this->createUserMerchant($gui, $hubBelfort) ; |
|
|
|
$this->createUserMerchant($gui, $hubBesac) ; |
|
|
|
|
|
|
|
$this->createSessionsBesak($hubBesac, $fab); |
|
|
|
$this->createSectionBelfort($hubBelfort, $fab); |
|
|
|
|
|
|
@@ -78,7 +88,7 @@ class CaracoleFixtures extends Fixture |
|
|
|
$hubBelfort->setCreatedBy($fab)->setUpdatedBy($fab)->setStatus(1); |
|
|
|
$hubBesac->setCreatedBy($fab)->setUpdatedBy($fab)->setStatus(1); |
|
|
|
|
|
|
|
|
|
|
|
$this->em->persist($charly); |
|
|
|
$this->em->persist($fab); |
|
|
|
$this->em->persist($gui); |
|
|
|
$this->em->persist($taxRate); |
|
|
@@ -93,7 +103,8 @@ class CaracoleFixtures extends Fixture |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function createSectionBelfort($hubBelfort, $user){ |
|
|
|
protected function createSectionBelfort($hubBelfort, $user) |
|
|
|
{ |
|
|
|
$sectionBelfort[0] = new Section(); |
|
|
|
$sectionBelfort[0]->setTitle('Marché'); |
|
|
|
$sectionBelfort[0]->setStatus(1); |
|
|
@@ -136,7 +147,8 @@ class CaracoleFixtures extends Fixture |
|
|
|
return $sectionBelfort; |
|
|
|
} |
|
|
|
|
|
|
|
protected function createSessionsBesak($hubBesak, $user){ |
|
|
|
protected function createSessionsBesak($hubBesak, $user) |
|
|
|
{ |
|
|
|
$sectionBesac = new Section(); |
|
|
|
$sectionBesac->setTitle('Marché'); |
|
|
|
$sectionBesac->setStatus(1); |
|
|
@@ -152,8 +164,7 @@ class CaracoleFixtures extends Fixture |
|
|
|
return $sectionBesac; |
|
|
|
} |
|
|
|
|
|
|
|
protected |
|
|
|
function createUserFab() |
|
|
|
protected function createUserFab() |
|
|
|
{ |
|
|
|
$fab = new User(); |
|
|
|
$fab->setEmail('fab@laclic.fr'); |
|
|
@@ -161,11 +172,11 @@ class CaracoleFixtures extends Fixture |
|
|
|
$fab->setFirstname('Fab'); |
|
|
|
$fab->setPassword('$2y$13$ExSKxXX8bQ20fBocZrUAJugov2MfE2x14BxsQaVyODsousxPWS2gS'); |
|
|
|
$fab->setRoles(array('ROLE_ADMIN', 'ROLE_SUPER_ADMIN')); |
|
|
|
|
|
|
|
return $fab; |
|
|
|
} |
|
|
|
|
|
|
|
protected |
|
|
|
function createUserGui() |
|
|
|
protected function createUserGui() |
|
|
|
{ |
|
|
|
$gui = new User(); |
|
|
|
$gui->setEmail('guillaume@laclic.fr'); |
|
|
@@ -177,8 +188,28 @@ class CaracoleFixtures extends Fixture |
|
|
|
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 = [ |
|
|
|
'piece' => [ |