mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add 2 fixtures for parcours
This commit is contained in:
@@ -22,8 +22,6 @@
|
||||
|
||||
namespace Chill\PersonBundle\DataFixtures\ORM;
|
||||
|
||||
|
||||
//use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
@@ -54,31 +52,37 @@ class LoadAccompanyingPeriod extends AbstractFixture implements OrderedFixtureIn
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
|
||||
// $centerA = $this->getReference('centerA');
|
||||
// $centerAId = $centerA->getId();
|
||||
// dump($centerA);
|
||||
// dump($centerAId);
|
||||
$centerA = $this->getReference('centerA');
|
||||
$centerAId = $centerA->getId();
|
||||
|
||||
// $personIds = $this->container->get('doctrine.orm.entity_manager')
|
||||
// ->createQuery("SELECT person.id FROM ChillPersonBundle:Person person WHERE person.center_id = ".$centerAId." ORDER BY person.id LIMIT 2;")
|
||||
// ->getScalarResult();
|
||||
|
||||
// dump($personIds);
|
||||
$personIds = $this->container->get('doctrine.orm.entity_manager')
|
||||
->createQuery(
|
||||
'
|
||||
SELECT person.id
|
||||
FROM ChillPersonBundle:Person person
|
||||
WHERE person.center = ' . $centerAId . '
|
||||
ORDER BY person.id
|
||||
'
|
||||
)
|
||||
->getScalarResult();
|
||||
|
||||
$openingDate = new \DateTime('2020-04-01');
|
||||
|
||||
// $person1 = $manager->getRepository(Person::class)->find($personIds[0]);
|
||||
$person1 = $manager->getRepository(Person::class)->find($personIds[0]);
|
||||
$person2 = $manager->getRepository(Person::class)->find($personIds[1]);
|
||||
|
||||
$socialScope = $this->getReference('scope_social');
|
||||
|
||||
$a = new AccompanyingPeriod($openingDate);
|
||||
$a->setClosingDate(new \DateTime('2021-05-01'));
|
||||
|
||||
// $a->addPerson($person1);
|
||||
$a->addPerson($person1);
|
||||
$a->addPerson($person2);
|
||||
$a->addScope($socialScope);
|
||||
$a->setStep(AccompanyingPeriod::STEP_CONFIRMED);
|
||||
|
||||
$manager->persist($a);
|
||||
|
||||
$this->addReference(self::ACCOMPANYING_PERIOD, $a);
|
||||
echo "Adding 1 AccompanyingPeriod\n";
|
||||
|
||||
echo "Adding one AccompanyingPeriod\n";
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
Reference in New Issue
Block a user