vendor/bluue/mondialrelay-bundle/migrations/Version20221215121948.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace MondialrelayBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use App\Services\ObjectSerialize;
  6. use Symfony\Component\Uid\UuidV6;
  7. use Doctrine\Migrations\AbstractMigration;
  8. final class Version20221215121948 extends AbstractMigration
  9. {
  10.     private ObjectSerialize $objectSerialize;
  11.     public function setObjectSerialize(ObjectSerialize $objectSerialize)
  12.     {
  13.         $this->objectSerialize $objectSerialize;
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.     }
  21.     public function postUp(Schema $schema): void
  22.     {
  23.         parent::postUp($schema);
  24.         $now = (new \DateTime())->format('Y-m-d H:i:s');
  25.         $configurations = [
  26.             'mondialrelay_bundle__sender_company_name' => 'Nom société',
  27.             'mondialrelay_bundle__sender_address' => 'adresse',
  28.             'mondialrelay_bundle__sender_address2' => '',
  29.             'mondialrelay_bundle__sender_city' => 'Troyes',
  30.             'mondialrelay_bundle__sender_zip_code' => '10000',
  31.             'mondialrelay_bundle__sender_phone' => '',
  32.             'mondialrelay_bundle__sender_mobile_phone' => '',
  33.             'mondialrelay_bundle__sender_language_iso' => 'FR',
  34.             'mondialrelay_bundle__sender_country_iso_code' => 'FR',
  35.             'mondialrelay_bundle__sender_mail' => ''
  36.         ];
  37.         foreach ($configurations as $configuration => $value) {
  38.             $this->connection->insert('configuration', [
  39.                 'id' => (new UuidV6())->toBinary(),
  40.                 'name' => $configuration,
  41.                 'context_id' => null,
  42.                 'value' => $this->objectSerialize->add((object) ['value' => $value]),
  43.                 'created_at' => $now,
  44.                 'updated_at' => $now
  45.             ]);
  46.         }
  47.     }
  48. }