vendor/bluue/shipments-picture-bundle/migrations/Version20221208152739.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ShipmentsPictureBundleMigrations;
  4. use App\Services\ObjectSerialize;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. use Symfony\Component\Uid\UuidV6;
  8. /**
  9.  * Auto-generated Migration: Please modify to your needs!
  10.  */
  11. final class Version20221208152739 extends AbstractMigration
  12. {
  13.     private ObjectSerialize $objectSerialize;
  14.     public function setObjectSerialize(ObjectSerialize $objectSerialize)
  15.     {
  16.         $this->objectSerialize $objectSerialize;
  17.     }
  18.     public function up(Schema $schema): void
  19.     {
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.     }
  24.     public function postUp(Schema $schema): void
  25.     {
  26.         parent::postUp($schema);
  27.         $now = (new \DateTime())->format('Y-m-d H:i:s');
  28.         $mailContent '<p>Votre commande vient d\'être expédiée</p><p>Passez une bonne journée</p>';
  29.         $configurations = [
  30.             'shipments_picture_bundle__mail_subject' => 'Expédition en cours',
  31.             'shipments_picture_bundle__mail_content' => $mailContent
  32.         ];
  33.         foreach ($configurations as $configuration => $value) {
  34.             $this->connection->insert('configuration', [
  35.                 'id' => (new UuidV6())->toBinary(),
  36.                 'name' => $configuration,
  37.                 'context_id' => null,
  38.                 'value' => $this->objectSerialize->add((object) ['value' => $value]),
  39.                 'created_at' => $now,
  40.                 'updated_at' => $now
  41.             ]);
  42.         }
  43.     }
  44. }