Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
auth
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lib
unicaen
auth
Commits
f6d8df4d
Commit
f6d8df4d
authored
Mar 26, 2019
by
Bertrand Gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UserMapper n'a pas besoin d'hériter de \ZfcUser\Mapper\User.
parent
f0cfcb41
Pipeline
#4156
passed with stage
in 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
src/UnicaenAuth/Service/UserMapper.php
src/UnicaenAuth/Service/UserMapper.php
+25
-5
No files found.
src/UnicaenAuth/Service/UserMapper.php
View file @
f6d8df4d
...
...
@@ -5,9 +5,10 @@ namespace UnicaenAuth\Service;
use
Doctrine\ORM\EntityManagerInterface
;
use
UnicaenAuth\Entity\Db\AbstractUser
;
use
UnicaenAuth\Options\ModuleOptions
;
use
Zend\Hydrator\HydratorInterface
;
use
ZfcUser\Entity\UserInterface
as
UserEntityInterface
;
use
ZfcUser\Mapper\UserInterface
;
class
UserMapper
extends
\
ZfcUser\Mapper\User
class
UserMapper
implements
UserInterface
{
//========== repris du module zf-commons/zfc-user-doctrine-orm abandonné =========
/**
...
...
@@ -20,12 +21,21 @@ class UserMapper extends \ZfcUser\Mapper\User
*/
protected
$options
;
/**
* UserMapper constructor.
*
* @param EntityManagerInterface $em
* @param ModuleOptions $options
*/
public
function
__construct
(
EntityManagerInterface
$em
,
ModuleOptions
$options
)
{
$this
->
em
=
$em
;
$this
->
options
=
$options
;
}
/**
* {@inheritdoc}
*/
public
function
findByEmail
(
$email
)
{
$er
=
$this
->
em
->
getRepository
(
$this
->
options
->
getUserEntityClass
());
...
...
@@ -33,6 +43,9 @@ class UserMapper extends \ZfcUser\Mapper\User
return
$er
->
findOneBy
(
array
(
'email'
=>
$email
));
}
/**
* {@inheritdoc}
*/
public
function
findByUsername
(
$username
)
{
$er
=
$this
->
em
->
getRepository
(
$this
->
options
->
getUserEntityClass
());
...
...
@@ -40,6 +53,9 @@ class UserMapper extends \ZfcUser\Mapper\User
return
$er
->
findOneBy
(
array
(
'username'
=>
$username
));
}
/**
* {@inheritdoc}
*/
public
function
findById
(
$id
)
{
$er
=
$this
->
em
->
getRepository
(
$this
->
options
->
getUserEntityClass
());
...
...
@@ -50,7 +66,7 @@ class UserMapper extends \ZfcUser\Mapper\User
/**
* {@inheritdoc}
*/
public
function
insert
(
$entity
,
$tableName
=
null
,
HydratorInterface
$hydrator
=
null
)
public
function
insert
(
UserEntityInterface
$entity
)
{
return
$this
->
persist
(
$entity
);
}
...
...
@@ -58,12 +74,16 @@ class UserMapper extends \ZfcUser\Mapper\User
/**
* {@inheritdoc}
*/
public
function
update
(
$entity
,
$where
=
null
,
$tableName
=
null
,
HydratorInterface
$hydrator
=
null
)
public
function
update
(
UserEntityInterface
$entity
)
{
return
$this
->
persist
(
$entity
);
}
protected
function
persist
(
$entity
)
/**
* @param UserEntityInterface $entity
* @return mixed
*/
protected
function
persist
(
UserEntityInterface
$entity
)
{
$this
->
em
->
persist
(
$entity
);
$this
->
em
->
flush
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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