mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Merge branch '52-repair-fixtures' into 'master'
Repair fixtures See merge request Chill-Projet/chill-bundles!494
This commit is contained in:
@@ -61,7 +61,7 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
|
||||
->setEmail('centreA@test.chill.social')
|
||||
->setLocationType($type = new LocationType())
|
||||
->setPhonenumber1(PhoneNumberUtil::getInstance()->parse('+3287653812'));
|
||||
$type->setTitle('Service');
|
||||
$type->setTitle(['fr' => 'Service']);
|
||||
$address->setStreet('Rue des Épaules')->setStreetNumber('14')
|
||||
->setPostcode($postCode = new PostalCode());
|
||||
$postCode->setCode('4145')->setName('Houte-Si-Plout')->setCountry(
|
||||
|
@@ -12,6 +12,8 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Invite;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
@@ -33,14 +35,21 @@ class LoadInvite extends Fixture implements FixtureGroupInterface
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$arr = [
|
||||
['name' => ['fr' => 'Rendez-vous décliné']],
|
||||
['name' => ['fr' => 'Rendez-vous accepté']],
|
||||
[
|
||||
'name' => ['fr' => 'Rendez-vous décliné'],
|
||||
'status' => Invite::DECLINED,
|
||||
],
|
||||
[
|
||||
'name' => ['fr' => 'Rendez-vous accepté'],
|
||||
'status' => Invite::ACCEPTED,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($arr as $a) {
|
||||
echo 'Creating calendar invite : ' . $a['name']['fr'] . "\n";
|
||||
$invite = (new Invite())
|
||||
->setStatus($a['name']);
|
||||
->setStatus($a['status'])
|
||||
->setUser($this->getRandomUser());
|
||||
$manager->persist($invite);
|
||||
$reference = 'Invite_' . $a['name']['fr'];
|
||||
$this->addReference($reference, $invite);
|
||||
@@ -49,4 +58,11 @@ class LoadInvite extends Fixture implements FixtureGroupInterface
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
private function getRandomUser(): User
|
||||
{
|
||||
$userRef = array_rand(LoadUsers::$refs);
|
||||
|
||||
return $this->getReference($userRef);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user