diff --git a/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php b/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php index 5d9a583b8..1149ad394 100644 --- a/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php +++ b/src/Bundle/ChillBudgetBundle/migrations/Version20221207105407.php @@ -14,13 +14,9 @@ namespace Chill\Migrations\Budget; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Types\Types; use Doctrine\Migrations\AbstractMigration; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -final class Version20221207105407 extends AbstractMigration implements ContainerAwareInterface +final class Version20221207105407 extends AbstractMigration { - public ContainerInterface $container; - public function down(Schema $schema): void { $this->addSql('DELETE FROM chill_budget.resource_type;'); @@ -32,14 +28,9 @@ final class Version20221207105407 extends AbstractMigration implements Container return 'Use new budget admin entities'; } - public function setContainer(?ContainerInterface $container = null): void - { - $this->container = $container; - } - public function up(Schema $schema): void { - $resources = $this->container->getParameter('chill_budget.resources'); +/* $resources = $this->container->getParameter('chill_budget.resources'); $charges = $this->container->getParameter('chill_budget.charges'); foreach ($resources as $value) { @@ -76,6 +67,6 @@ final class Version20221207105407 extends AbstractMigration implements Container ['kind' => $kind], ['kind' => Types::STRING] ); - } + }*/ } } diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php index 8473595d4..5cb3f12e4 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php @@ -16,8 +16,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; + /** * Load countries into database. diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php index 473504f48..206cfd6fd 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php @@ -13,11 +13,8 @@ namespace Chill\MainBundle\DataFixtures\ORM; use Chill\MainBundle\Entity\Language; use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Load languages into database. diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php index 9a47608c8..09de1eb20 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php @@ -16,7 +16,6 @@ use Chill\MainBundle\Entity\User; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactory; /** diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php b/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php index 040aadf38..001c2dbf7 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php @@ -14,13 +14,9 @@ namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; use libphonenumber\PhoneNumberUtil; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; -final class Version20220302132728 extends AbstractMigration implements ContainerAwareInterface +final class Version20220302132728 extends AbstractMigration { - use ContainerAwareTrait; - public function down(Schema $schema): void { $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 TYPE VARCHAR(64)'); @@ -38,11 +34,10 @@ final class Version20220302132728 extends AbstractMigration implements Container public function up(Schema $schema): void { - $carrier_code = $this->container - ->getParameter('chill_main')['phone_helper']['default_carrier_code']; + $carrierCode = getenv('DEFAULT_CARRIER_CODE'); - if (null === $carrier_code) { - throw new \RuntimeException('no carrier code'); + if (!$carrierCode) { + throw new \RuntimeException('Environment variable DEFAULT_CARRIER_CODE is not set.'); } $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 TYPE VARCHAR(35)'); @@ -56,9 +51,9 @@ final class Version20220302132728 extends AbstractMigration implements Container $this->addSql( 'UPDATE chill_main_location SET '. - $this->buildMigrationPhonenumberClause($carrier_code, 'phonenumber1'). + $this->buildMigrationPhonenumberClause($carrierCode, 'phonenumber1'). ', '. - $this->buildMigrationPhoneNumberClause($carrier_code, 'phonenumber2') + $this->buildMigrationPhoneNumberClause($carrierCode, 'phonenumber2') ); } diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php index 02b1855d8..0690a42c9 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php @@ -38,7 +38,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Faker\Generator; use Nelmio\Alice\Loader\NativeLoader; use Nelmio\Alice\ObjectSet; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\Workflow\Registry; /** @@ -46,8 +45,6 @@ use Symfony\Component\Workflow\Registry; */ class LoadPeople extends Fixture implements OrderedFixtureInterface { - use \Symfony\Component\DependencyInjection\ContainerAwareTrait; - final public const PERSON = 'person'; /** diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220215135509.php b/src/Bundle/ChillPersonBundle/migrations/Version20220215135509.php index 5c7106e77..4c00919a4 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20220215135509.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220215135509.php @@ -14,13 +14,9 @@ namespace Chill\Migrations\Person; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; use libphonenumber\PhoneNumberUtil; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; -final class Version20220215135509 extends AbstractMigration implements ContainerAwareInterface +final class Version20220215135509 extends AbstractMigration { - use ContainerAwareTrait; - public function down(Schema $schema): void { throw new \Exception('You should not do that.'); @@ -33,11 +29,10 @@ final class Version20220215135509 extends AbstractMigration implements Container public function up(Schema $schema): void { - $carrier_code = $this->container - ->getParameter('chill_main')['phone_helper']['default_carrier_code']; + $carrierCode = getenv('DEFAULT_CARRIER_CODE'); // Directly from the .env - if (null === $carrier_code) { - throw new \RuntimeException('no carrier code'); + if (!$carrierCode) { + throw new \RuntimeException('Environment variable DEFAULT_CARRIER_CODE is not set.'); } $this->addSql('ALTER TABLE chill_person_person ALTER phonenumber TYPE TEXT'); @@ -52,9 +47,9 @@ final class Version20220215135509 extends AbstractMigration implements Container $this->addSql( 'UPDATE chill_person_person SET '. - $this->buildMigrationPhonenumberClause($carrier_code, 'phonenumber'). + $this->buildMigrationPhonenumberClause($carrierCode, 'phonenumber'). ', '. - $this->buildMigrationPhoneNumberClause($carrier_code, 'mobilenumber') + $this->buildMigrationPhoneNumberClause($carrierCode, 'mobilenumber') ); $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT'); @@ -64,7 +59,7 @@ final class Version20220215135509 extends AbstractMigration implements Container $this->addSql( 'UPDATE chill_person_phone SET '. - $this->buildMigrationPhoneNumberClause($carrier_code, 'phonenumber') + $this->buildMigrationPhoneNumberClause($carrierCode, 'phonenumber') ); } diff --git a/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php b/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php index bc61da44c..e7a98a48e 100644 --- a/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php +++ b/src/Bundle/ChillReportBundle/migrations/Version20150622233319.php @@ -14,16 +14,12 @@ namespace Chill\Migrations\Report; use Chill\MainBundle\Entity\Scope; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Add a scope to report. */ -class Version20150622233319 extends AbstractMigration implements ContainerAwareInterface +class Version20150622233319 extends AbstractMigration { - private ?ContainerInterface $container = null; - public function down(Schema $schema): void { $this->abortIf( @@ -37,15 +33,6 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI $this->addSql('ALTER TABLE Report DROP scope_id'); } - public function setContainer(?ContainerInterface $container = null): void - { - if (null === $container) { - throw new \RuntimeException('Container is not provided. This migration need container to set a default center'); - } - - $this->container = $container; - } - public function up(Schema $schema): void { $this->abortIf( diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20220302143821.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20220302143821.php index 9c4267235..ab11d696a 100644 --- a/src/Bundle/ChillThirdPartyBundle/migrations/Version20220302143821.php +++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20220302143821.php @@ -14,12 +14,9 @@ namespace Chill\Migrations\ThirdParty; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; use libphonenumber\PhoneNumberUtil; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; -final class Version20220302143821 extends AbstractMigration implements ContainerAwareInterface +final class Version20220302143821 extends AbstractMigration { - use ContainerAwareTrait; public function down(Schema $schema): void { @@ -35,11 +32,10 @@ final class Version20220302143821 extends AbstractMigration implements Container public function up(Schema $schema): void { - $carrier_code = $this->container - ->getParameter('chill_main')['phone_helper']['default_carrier_code']; + $carrierCode = getenv('DEFAULT_CARRIER_CODE'); // Directly from the .env - if (null === $carrier_code) { - throw new \RuntimeException('no carrier code'); + if (!$carrierCode) { + throw new \RuntimeException('Environment variable DEFAULT_CARRIER_CODE is not set.'); } $this->addSql('ALTER TABLE chill_3party.third_party ALTER telephone TYPE VARCHAR(35)'); @@ -49,7 +45,7 @@ final class Version20220302143821 extends AbstractMigration implements Container $this->addSql( 'UPDATE chill_3party.third_party SET '. - $this->buildMigrationPhonenumberClause($carrier_code, 'telephone') + $this->buildMigrationPhonenumberClause($carrierCode, 'telephone') ); }