vendor/bluue/sales-bundle/migrations/Version20231024143937.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace SalesBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use App\Services\ObjectSerialize;
  6. use Symfony\Component\Uid\UuidV6;
  7. use Doctrine\Migrations\AbstractMigration;
  8. /**
  9.  * Auto-generated Migration: Please modify to your needs!
  10.  */
  11. final class Version20231024143937 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.         $configurations = [
  29.             'sales_bundle__order_remaining_lines_with_quantity_0' => false
  30.         ];
  31.         foreach ($configurations as $configuration => $value) {
  32.             $this->connection->insert('configuration', [
  33.                 'id' => (new UuidV6())->toBinary(),
  34.                 'name' => $configuration,
  35.                 'context_id' => null,
  36.                 'value' => $this->objectSerialize->add((object) ['value' => $value]),
  37.                 'created_at' => $now,
  38.                 'updated_at' => $now
  39.             ]);
  40.         }
  41.     }
  42. }