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
35ab756c
Commit
35ab756c
authored
Feb 01, 2016
by
Laurent Lécluse
Browse files
Ajout d'un trait de service
parent
5accddf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/Service/Traits/CategoriePrivilegeServiceAwareTrait.php
0 → 100644
View file @
35ab756c
<?php
namespace
UnicaenAuth\Service\Traits
;
use
UnicaenAuth\Service\CategoriePrivilegeService
;
use
RuntimeException
;
/**
* Description of CategoriePrivilegeServiceAwareTrait
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
trait
CategoriePrivilegeServiceAwareTrait
{
/**
* @var CategoriePrivilegeService
*/
private
$serviceCategoriePrivilege
;
/**
* @param CategoriePrivilegeService $serviceCategoriePrivilege
*
* @return self
*/
public
function
setServiceCategoriePrivilege
(
CategoriePrivilegeService
$serviceCategoriePrivilege
)
{
$this
->
serviceCategoriePrivilege
=
$serviceCategoriePrivilege
;
return
$this
;
}
/**
* @return CategoriePrivilegeService
* @throws RuntimeException
*/
public
function
getServiceCategoriePrivilege
()
{
if
(
empty
(
$this
->
serviceCategoriePrivilege
))
{
if
(
!
method_exists
(
$this
,
'getServiceLocator'
))
{
throw
new
RuntimeException
(
'La classe '
.
get_class
(
$this
)
.
' n\'a pas accès au ServiceLocator.'
);
}
$serviceLocator
=
$this
->
getServiceLocator
();
if
(
method_exists
(
$serviceLocator
,
'getServiceLocator'
))
{
$serviceLocator
=
$serviceLocator
->
getServiceLocator
();
}
$this
->
serviceCategoriePrivilege
=
$serviceLocator
->
get
(
'UnicaenAuth\Service\CategoriePrivilege'
);
}
return
$this
->
serviceCategoriePrivilege
;
}
}
\ No newline at end of file
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