Remove containerAwareInterface, no longer supported in sf72

This commit is contained in:
Julie Lenaerts 2025-05-27 14:06:36 +02:00
parent 46f9e4968b
commit ebaff8d170
9 changed files with 23 additions and 67 deletions

View File

@ -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]
);
}
}*/
}
}

View File

@ -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.

View File

@ -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.

View File

@ -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;
/**

View File

@ -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')
);
}

View File

@ -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';
/**

View File

@ -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')
);
}

View File

@ -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(

View File

@ -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')
);
}