-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref #215: create bank fixtures and update existing payments
- Loading branch information
Showing
3 changed files
with
87 additions
and
4 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,59 @@ | ||
<?php | ||
|
||
namespace App\DataFixtures; | ||
|
||
use Doctrine\Bundle\FixturesBundle\Fixture; | ||
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface; | ||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Symfony\Component\Console\Output\ConsoleOutput; | ||
use App\Entity\Bank; | ||
|
||
class BankFixtures extends Fixture implements FixtureGroupInterface | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public static function getGroups(): array | ||
{ | ||
return ['banks']; | ||
} | ||
|
||
public function load(ObjectManager $manager) | ||
{ | ||
// Create logger used to display information messages | ||
$output = new ConsoleOutput(); | ||
|
||
// Create pool of banks | ||
$output->writeln(' <comment>></comment> <info>Banks creation...</info>'); | ||
$bankRepository = $manager->getRepository(Bank::class); | ||
|
||
$bank = new Bank(); | ||
$bank->setName('Société Générale'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('BNP Paribas'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('La Banque Postale'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('HSBC'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('LCL'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('Allianz Banque'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('AXA Banque'); | ||
$manager->persist($bank); | ||
$bank = new Bank(); | ||
$bank->setName('Groupama Banque'); | ||
$manager->persist($bank); | ||
|
||
$manager->flush(); | ||
$output->writeln(' <comment>></comment> <info>Banks creation complete</info>'); | ||
} | ||
} |
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