Commit f7055b82 authored by Avris's avatar Avris

v4.0

parent faf59f6a
Avris\Micrus\Doctrine\:
dir: '%MODULE_DIR%/src/'
exclude:
- '#^DoctrineUserProvider$#'
Avris\Micrus\Doctrine\Doctrine:
arguments:
......@@ -9,7 +7,9 @@ Avris\Micrus\Doctrine\Doctrine:
$proxyDir: '%PROJECT_DIR%/var/cache/{@env}/doctrine'
$cache: '@?doctrineCache'
# TODO userProvider: Avris\Micrus\Doctrine\DoctrineUserProvider
Avris\Micrus\Model\User\UserProviderInterface: Avris\Micrus\Doctrine\DoctrineUserProvider
Avris\Micrus\Doctrine\DoctrineUserProvider:
public: true
Doctrine\ORM\EntityManagerInterface:
resolve: '@Avris\Micrus\Doctrine\Doctrine.entityManager'
......@@ -2,23 +2,27 @@
namespace Avris\Micrus\Doctrine;
use Avris\Micrus\Model\User\UserProviderInterface;
use Doctrine\ORM\EntityManagerInterface;
class DoctrineUserProvider implements UserProviderInterface
{
/** @var Doctrine */
protected $orm;
/** @var EntityManagerInterface */
protected $em;
/** @var string */
protected $column;
public function __construct(Doctrine $orm, $column = 'email')
public function __construct(EntityManagerInterface $em, $column = 'email')
{
$this->orm = $orm;
$this->em = $em;
$this->column = $column;
}
public function getUser($identifier)
{
return $this->orm->findOneBy('App\Entity\User', $this->column, $identifier);
$this->column = 'username'; // TODO
return $this->em->getRepository('App\Entity\User') // TODO
->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