<?php
declare(strict_types=1);
namespace MondialrelayBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use App\Services\ObjectSerialize;
use Symfony\Component\Uid\UuidV6;
use Doctrine\Migrations\AbstractMigration;
final class Version20221215121948 extends AbstractMigration
{
private ObjectSerialize $objectSerialize;
public function setObjectSerialize(ObjectSerialize $objectSerialize)
{
$this->objectSerialize = $objectSerialize;
}
public function up(Schema $schema): void
{
}
public function down(Schema $schema): void
{
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$now = (new \DateTime())->format('Y-m-d H:i:s');
$configurations = [
'mondialrelay_bundle__sender_company_name' => 'Nom société',
'mondialrelay_bundle__sender_address' => 'adresse',
'mondialrelay_bundle__sender_address2' => '',
'mondialrelay_bundle__sender_city' => 'Troyes',
'mondialrelay_bundle__sender_zip_code' => '10000',
'mondialrelay_bundle__sender_phone' => '',
'mondialrelay_bundle__sender_mobile_phone' => '',
'mondialrelay_bundle__sender_language_iso' => 'FR',
'mondialrelay_bundle__sender_country_iso_code' => 'FR',
'mondialrelay_bundle__sender_mail' => ''
];
foreach ($configurations as $configuration => $value) {
$this->connection->insert('configuration', [
'id' => (new UuidV6())->toBinary(),
'name' => $configuration,
'context_id' => null,
'value' => $this->objectSerialize->add((object) ['value' => $value]),
'created_at' => $now,
'updated_at' => $now
]);
}
}
}