Version20220329182822.php 1.87 KB
Newer Older
Julien Jorry committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use App\Entity\AccountPrestataire;
use App\Entity\Prestataire;
use App\Enum\CurrencyEnum;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20220329182822 extends AbstractMigration implements ContainerAwareInterface
{
    /**
     * @var ObjectManager
     */
    protected $em;

    public function setContainer(ContainerInterface $container = null)
    {
        $this->em = $container->get('doctrine')->getManager();
    }

    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
    }

    public function postUp(Schema $schema): void
    {
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
        //EXPLANATION FOR CONTENT REMOVAL OF THIS VERSION :
        //We have added new attributes in class Prestataire which cause this migration to fail
        //Removing the content of this migration should not cause any issue because it does not
        //modify the database structure and because data will be purged at the next install step

//        $presta = $this->em->getRepository(Prestataire::class)->getPrestataireSolidoume();
//        // this up() migration is auto-generated, please modify it to your needs
//        $account = new AccountPrestataire();
//        $account
//            ->setBalance(0)
//            ->setCurrency(CurrencyEnum::CURRENCY_EMLC)
//        ;
//        $presta->addAccount($account);
//        $this->em->persist($account);
//        $this->em->persist($presta);
//        $this->em->flush();
Julien Jorry committed
57 58 59 60 61 62 63
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
    }
}