Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
8b2b7202
Commit
8b2b7202
authored
Mar 01, 2019
by
Bertrand Gauthier
Browse files
Merge branch 'zf-2.x' of git.unicaen.fr:lib/unicaen/auth into zf-2.x
parents
b7967a21
a6c8e699
Pipeline
#3822
passed with stage
in 21 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Module.php
View file @
8b2b7202
...
...
@@ -118,6 +118,13 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se
public
function
getServiceConfig
()
{
return
[
//========== repris du module zf-commons/zfc-user-doctrine-orm abandonné =========
'aliases'
=>
array
(
'zfcuser_doctrine_em'
=>
'Doctrine\ORM\EntityManager'
,
),
//===========================================
'factories'
=>
[
//========== repris du module zf-commons/zfc-user-doctrine-orm abandonné =========
'zfcuser_module_options'
=>
function
(
$sm
)
{
...
...
doc/installation.md
View file @
8b2b7202
...
...
@@ -35,7 +35,7 @@ La commande ci-dessus fonctionne seulement si le binaire composer.phar se trouve
'modules' => array(
'Application',
'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser',
'ZfcUserDoctrineORM',
'BjyAuthorize',
'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser', 'BjyAuthorize',
'UnicaenApp', 'AssetManager',
'UnicaenAuth',
// ...
...
...
src/UnicaenAuth/Service/UserMapper.php
View file @
8b2b7202
...
...
@@ -2,11 +2,73 @@
namespace
UnicaenAuth\Service
;
use
Doctrine\ORM\EntityManagerInterface
;
use
UnicaenAuth\Entity\Db\AbstractUser
;
use
ZfcUserDoctrineORM\Mapper\User
as
ZfcUserDoctrineORMUserMapper
;
use
UnicaenAuth\Options\ModuleOptions
;
use
Zend\Hydrator\HydratorInterface
;
use
ZfcUser\Entity\UserInterface
;
class
UserMapper
extends
ZfcUser
DoctrineORMUser
Mapper
class
UserMapper
extends
\
ZfcUser
\
Mapper
\User
{
//========== repris du module zf-commons/zfc-user-doctrine-orm abandonné =========
/**
* @var \Doctrine\ORM\EntityManagerInterface
*/
protected
$em
;
/**
* @var ModuleOptions
*/
protected
$options
;
public
function
__construct
(
EntityManagerInterface
$em
,
ModuleOptions
$options
)
{
$this
->
em
=
$em
;
$this
->
options
=
$options
;
}
public
function
findByEmail
(
$email
)
{
$er
=
$this
->
em
->
getRepository
(
$this
->
options
->
getUserEntityClass
());
return
$er
->
findOneBy
(
array
(
'email'
=>
$email
));
}
public
function
findByUsername
(
$username
)
{
$er
=
$this
->
em
->
getRepository
(
$this
->
options
->
getUserEntityClass
());
return
$er
->
findOneBy
(
array
(
'username'
=>
$username
));
}
public
function
findById
(
$id
)
{
$er
=
$this
->
em
->
getRepository
(
$this
->
options
->
getUserEntityClass
());
return
$er
->
find
(
$id
);
}
public
function
insert
(
UserInterface
$entity
,
$tableName
=
null
,
HydratorInterface
$hydrator
=
null
)
{
return
$this
->
persist
(
$entity
);
}
public
function
update
(
UserInterface
$entity
,
$where
=
null
,
$tableName
=
null
,
HydratorInterface
$hydrator
=
null
)
{
return
$this
->
persist
(
$entity
);
}
protected
function
persist
(
$entity
)
{
$this
->
em
->
persist
(
$entity
);
$this
->
em
->
flush
();
return
$entity
;
}
//===================
/**
* Recherche un utilisateur par son username (identifiant de connexion).
*
...
...
src/UnicaenAuth/Service/UserMapperFactory.php
View file @
8b2b7202
...
...
@@ -3,6 +3,7 @@
namespace
UnicaenAuth\Service
;
use
Doctrine\ORM\EntityManagerInterface
;
use
UnicaenAuth\Options\ModuleOptions
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -19,7 +20,7 @@ class UserMapperFactory implements FactoryInterface
/** @var EntityManagerInterface $em */
$em
=
$serviceLocator
->
get
(
'zfcuser_doctrine_em'
);
/** @var
\ZfcUserDoctrineORM\Options\
ModuleOptions $options */
/** @var ModuleOptions $options */
$options
=
$serviceLocator
->
get
(
'zfcuser_module_options'
);
return
new
UserMapper
(
$em
,
$options
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment