<?php
declare(strict_types=1);
namespace PrestashopConnectorBundleMigrations;
use App\Services\ObjectSerialize;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\Uid\UuidV6;
final class Version20240830085647 extends AbstractMigration
{
private ObjectSerialize $objectSerialize;
public function setObjectSerialize(ObjectSerialize $objectSerialize): void
{
$this->objectSerialize = $objectSerialize;
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$contexts = $this->connection->executeQuery('SELECT * FROM context WHERE deleted_at IS NULL')
->fetchAllAssociative();
$now = (new \DateTime())->format('Y-m-d H:i:s');
$this->connection->insert('configuration', [
'id' => (new UuidV6())->toBinary(),
'name' => 'prestashop_connector_bundle__sync_sales_to_presta',
'context_id' => null,
'value' => $this->objectSerialize->add((object) ['value' => true]),
'created_at' => $now,
'updated_at' => $now
]);
}
}