Commit 6cf036da authored by Avris's avatar Avris

Modernise to 4.0

parent 0dc11148
Avris\Micrus\Doctrine\:
dir: '%MODULE_DIR%/src/'
Avris\Micrus\Doctrine\Doctrine:
Avris\Micrus\Doctrine\DoctrineManager:
arguments:
$proxyDir: '%CACHE_DIR%/doctrine'
......@@ -10,5 +10,5 @@ Avris\Micrus\Doctrine\DoctrineUserProvider:
public: true
Doctrine\ORM\EntityManagerInterface:
resolve: '@Avris\Micrus\Doctrine\Doctrine.entityManager'
resolve: '@Avris\Micrus\Doctrine\DoctrineManager.entityManager'
public: true
......@@ -5,10 +5,10 @@ use Doctrine\DBAL\Logging\SQLLogger;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
class DoctrineLogger implements SQLLogger
final class DoctrineLogger implements SQLLogger
{
/** @var LoggerInterface */
protected $logger;
private $logger;
public function __construct(LoggerInterface $logger)
{
......
......@@ -16,7 +16,7 @@ use Psr\Log\LoggerInterface;
use Doctrine\ORM\Tools\Console\Command as ORMCommand;
use Doctrine\DBAL\Tools\Console\Command as DBALCommand;
class Doctrine implements EventSubscriberInterface
final class DoctrineManager implements EventSubscriberInterface
{
/** @var EntityManager */
private $entityManager;
......@@ -29,7 +29,8 @@ class Doctrine implements EventSubscriberInterface
LoggerInterface $logger,
DoctrineLogger $doctrineLogger,
Cache $cache = null
) {
)
{
$dirs = [];
/** @var ModuleInterface $module */
foreach (array_reverse($modules) as $module) {
......
......@@ -8,7 +8,7 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\MappingException;
class DoctrineMatchProvider implements MatchProvider
final class DoctrineMatchProvider implements MatchProvider
{
/** @var EntityManager */
private $em;
......
......@@ -5,7 +5,7 @@ use Avris\Micrus\Bootstrap\ModuleInterface;
use Avris\Micrus\Bootstrap\ModuleTrait;
use Avris\Micrus\Tool\Config\ParametersProvider;
class DoctrineModule implements ModuleInterface, ParametersProvider
final class DoctrineModule implements ModuleInterface, ParametersProvider
{
use ModuleTrait;
......
......@@ -5,25 +5,27 @@ use Avris\Micrus\Model\User\UserProviderInterface;
use Avris\Micrus\Model\User\UserInterface;
use Doctrine\ORM\EntityManagerInterface;
class DoctrineUserProvider implements UserProviderInterface
final class DoctrineUserProvider implements UserProviderInterface
{
/** @var EntityManagerInterface */
protected $em;
private $em;
/** @var string */
protected $column;
private $entity;
public function __construct(EntityManagerInterface $em, $column = 'email')
/** @var string */
private $column;
public function __construct(EntityManagerInterface $em, $entity = 'App\Entity\User', $column = 'email')
{
$this->em = $em;
$this->entity = $entity;
$this->column = $column;
}
public function getUser(string $identifier): ?UserInterface
{
$this->column = 'username'; // TODO
return $this->em->getRepository('App\Entity\User') // TODO
return $this->em->getRepository($this->entity)
->findOneBy([$this->column => $identifier]);
}
}
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