Commit 81bd4b85 authored by Avris's avatar Avris

v4.0

parent 7169ca59
......@@ -3,9 +3,7 @@ Avris\Micrus\Doctrine\:
Avris\Micrus\Doctrine\Doctrine:
arguments:
$connection: '@config.database'
$proxyDir: '%CACHE_DIR%/doctrine'
$cache: '@?doctrineCache'
Avris\Micrus\Model\User\UserProviderInterface: Avris\Micrus\Doctrine\DoctrineUserProvider
Avris\Micrus\Doctrine\DoctrineUserProvider:
......
......@@ -5,7 +5,6 @@ use Avris\Bag\Bag;
use Avris\Micrus\Bootstrap\EventSubscriberInterface;
use Avris\Micrus\Bootstrap\ModuleInterface;
use Avris\Micrus\Console\ConsoleWarmupEvent;
use Avris\Micrus\Tool\Config\ParametersProvider;
use Doctrine\Common\Cache\ClearableCache;
use Doctrine\Common\Proxy\Autoloader;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
......@@ -21,7 +20,7 @@ class Doctrine implements EventSubscriberInterface
protected $entityManager;
public function __construct(
Bag $connection,
Bag $configDatabase,
bool $envAppDebug,
string $proxyDir,
array $modules,
......@@ -39,7 +38,7 @@ class Doctrine implements EventSubscriberInterface
$config = Setup::createAnnotationMetadataConfiguration($dirs, $envAppDebug, $proxyDir, $cache, false);
$config->setSQLLogger(new DoctrineLogger($logger));
$this->entityManager = EntityManager::create($connection->all(), $config);
$this->entityManager = EntityManager::create($configDatabase->all(), $config);
if ($warmupMessage = $this->warmupCache()) {
$logger->notice($warmupMessage);
......
......@@ -2,9 +2,20 @@
namespace Avris\Micrus\Doctrine;
use Avris\Micrus\Console\Command\AbstractFixturesCommand;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Application;
abstract class DoctrineFixturesCommand extends AbstractFixturesCommand
{
/** @var EntityManagerInterface */
protected $em;
public function setApplication(Application $application = null)
{
parent::setApplication($application);
$this->em = $this->container->get(EntityManagerInterface::class);
}
protected function truncateDatabase()
{
$connection = $this->em->getConnection();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment