#!/usr/bin/env php
<?php

declare(strict_types=1);

use Doctrine\ORM\EntityManagerInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Application;

/** @var ContainerInterface $container */
$container = include __DIR__ . '/../bootstrap/app.php';

$console = $container->get(Application::class);
$console->setAutoExit(false);
$console->run();

try {
    // Persist data
    /** @var EntityManagerInterface $em */
    $em = $container->get(EntityManagerInterface::class);
    $em->flush();
} catch (NotFoundExceptionInterface) {
    // Do nothing
}
