Remove containerAwareInterface, no longer supported in sf72

This commit is contained in:
2025-05-27 14:06:36 +02:00
parent e3b2b7c6d1
commit 6cd17a8e36
9 changed files with 23 additions and 67 deletions

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