-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace App\DataFixtures; | ||
|
||
use App\Entity\Confirmer; | ||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\Persistence\ObjectManager; | ||
|
||
class ConfirmerFixture extends Fixture | ||
{ | ||
public const HHV_1 = '[email protected]'; | ||
public const TREASURER_1 = '[email protected]'; | ||
public const TREASURER_2 = '[email protected]'; | ||
|
||
public function load(ObjectManager $manager): void | ||
{ | ||
$confirmer = new Confirmer(); | ||
$confirmer->setEmail('[email protected]'); | ||
$confirmer->setName('HHV 1'); | ||
$this->addReference(self::HHV_1, $confirmer); | ||
$manager->persist($confirmer); | ||
|
||
$confirmer = new Confirmer(); | ||
$confirmer->setEmail('[email protected]'); | ||
$confirmer->setName('Treasurer 1'); | ||
$this->addReference(self::TREASURER_1, $confirmer); | ||
$manager->persist($confirmer); | ||
|
||
$confirmer = new Confirmer(); | ||
$confirmer->setEmail('[email protected]'); | ||
$confirmer->setName('Treasurer 2'); | ||
$this->addReference(self::TREASURER_2, $confirmer); | ||
$manager->persist($confirmer); | ||
|
||
$manager->flush(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,15 @@ | |
namespace App\DataFixtures; | ||
|
||
use App\Entity\BankAccount; | ||
use App\Entity\Confirmer; | ||
use App\Entity\Department; | ||
use App\Entity\DepartmentTypes; | ||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\Common\DataFixtures\DependentFixtureInterface; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Doctrine\Persistence\ObjectManager; | ||
|
||
final class DepartmentFixture extends Fixture | ||
final class DepartmentFixture extends Fixture implements DependentFixtureInterface | ||
{ | ||
public const DEPARTMENT1_REFERENCE = 'department1'; | ||
public const DEPARTMENT2_REFERENCE = 'department2'; | ||
|
@@ -35,8 +37,9 @@ public function load(ObjectManager $manager): void | |
$department->setBlocked(true); | ||
$department->setSkipBlockedValidationTokens(['token1', 'token2']); | ||
$department->setContactEmails(['[email protected]', '[email protected]']); | ||
$department->setEmailHhv(['[email protected]']); | ||
$department->setEmailTreasurer(['[email protected]', '[email protected]']); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::HHV_1, Confirmer::class)); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::TREASURER_1, Confirmer::class)); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::TREASURER_2, Confirmer::class)); | ||
$this->addReference(self::DEPARTMENT2_REFERENCE, $department); | ||
$manager->persist($department); | ||
|
||
|
@@ -46,8 +49,9 @@ public function load(ObjectManager $manager): void | |
$department->setBankAccount($this->getReference(BankAccountFixture::BANK_ACCOUNT1_REFERENCE, BankAccount::class)); | ||
$department->setComment('Test'); | ||
$department->setContactEmails(['[email protected]', '[email protected]']); | ||
$department->setEmailHhv(['[email protected]']); | ||
$department->setEmailTreasurer(['[email protected]', '[email protected]']); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::HHV_1, Confirmer::class)); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::TREASURER_1, Confirmer::class)); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::TREASURER_2, Confirmer::class)); | ||
$this->addReference(self::DEPARTMENT3_REFERENCE, $department); | ||
$manager->persist($department); | ||
|
||
|
@@ -63,10 +67,17 @@ public function load(ObjectManager $manager): void | |
$department->setName('Department 5'); | ||
$department->setType(DepartmentTypes::SECTION); | ||
$department->setBankAccount($this->getReference(BankAccountFixture::BANK_ACCOUNT3_REFERENCE, BankAccount::class)); | ||
$department->setEmailHhv(['[email protected]']); | ||
$department->getConfirmers()->add($this->getReference(ConfirmerFixture::HHV_1, Confirmer::class)); | ||
$this->addReference(self::DEPARTMENT5_REFERENCE, $department); | ||
$manager->persist($department); | ||
|
||
$manager->flush(); | ||
} | ||
|
||
public function getDependencies(): array | ||
{ | ||
return [ | ||
ConfirmerFixture::class | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters