vendor/bluue/colissimo-bundle/migrations/Version20221207152645.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ColissimoBundleMigrations;
  4. use App\Services\ObjectSerialize;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. use Symfony\Component\Uid\UuidV6;
  8. final class Version20221207152645 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.             'colissimo_bundle__item_description' => 'description',
  27.             'colissimo_bundle__label_format' => 'PDF_A4_300dpi'
  28.         ];
  29.         foreach ($configurations as $configuration => $value) {
  30.             $this->connection->insert('configuration', [
  31.                 'id' => (new UuidV6())->toBinary(),
  32.                 'name' => $configuration,
  33.                 'context_id' => null,
  34.                 'value' => $this->objectSerialize->add((object) ['value' => $value]),
  35.                 'created_at' => $now,
  36.                 'updated_at' => $now
  37.             ]);
  38.         }
  39.         shell_exec('bin/console do:fi:lo --append --group=colissimo_bundle_logo_svg');
  40.     }
  41. }