vendor/bluue/suppliers-orders-bundle/migrations/Version20230512120000.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace SuppliersOrdersBundleMigrations;
  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 Version20230512120000 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.             'suppliers_orders_bundle__override_product_wholesale_price_when_validate' => true,
  27.             'suppliers_orders_bundle__override_product_sell_price_when_validate' => true
  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.     }
  40. }