vendor/bluue/shipments-bundle/migrations/Version20230214141003.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ShipmentsBundleMigrations;
  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 Version20230214141003 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.         $fixtureFile dirname(__FILE__) . '/../src/Resources/views/TemplateMail/Fixtures/default.html.twig';
  26.         $this->connection->insert('configuration', [
  27.             'id' => (new UuidV6())->toBinary(),
  28.             'name' => 'shipments_bundle__template_mail_default',
  29.             'context_id' => null,
  30.             'value' => $this->objectSerialize->add((object) ['value' => file_get_contents($fixtureFile)]),
  31.             'created_at' => $now,
  32.             'updated_at' => $now
  33.         ]);
  34.     }
  35. }