Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
sygal-import-ws
Commits
d1513ead
Commit
d1513ead
authored
Jul 11, 2018
by
Bertrand Gauthier
Browse files
Modif service Acteur: possibilité de spécifier le paramètre 'these_id'.
parent
e262d9b3
Changes
2
Show whitespace changes
Inline
Side-by-side
module/ImportData/config/module.config.php
View file @
d1513ead
<?php
use
ImportData\V1\Rest\Acteur\ActeurFetchAll
;
return
[
'doctrine'
=>
[
'driver'
=>
[
...
...
@@ -18,6 +20,14 @@ return [
],
],
],
'zf-apigility-doctrine-query-provider'
=>
[
'aliases'
=>
[
'acteur_fetch_all'
=>
ActeurFetchAll
::
class
,
],
'factories'
=>
[
ActeurFetchAll
::
class
=>
\
Zend\ServiceManager\Factory\InvokableFactory
::
class
,
],
],
'router'
=>
[
'routes'
=>
[
'import-data.rest.doctrine.these'
=>
[
...
...
@@ -206,7 +216,9 @@ return [
'collection_http_methods'
=>
[
0
=>
'GET'
,
],
'collection_query_whitelist'
=>
[],
'collection_query_whitelist'
=>
[
0
=>
'these_id'
,
],
'page_size'
=>
'250000000000000000000'
,
'page_size_param'
=>
null
,
'entity_class'
=>
\
ImportData\V1\Entity\Db\Acteur
::
class
,
...
...
@@ -438,6 +450,10 @@ return [
0
=>
'application/json'
,
1
=>
'application/*+json'
,
],
'ImportData\\V1\\Rest\\Acteur\\Controller'
=>
[
0
=>
'application/json'
,
1
=>
'application/*+json'
,
],
],
'content_type_whitelist'
=>
[
'ImportData\\V1\\Rest\\Structure\\Controller'
=>
[
...
...
@@ -452,6 +468,9 @@ return [
'ImportData\\V1\\Rest\\UniteRecherche\\Controller'
=>
[
0
=>
'application/json'
,
],
'ImportData\\V1\\Rest\\Acteur\\Controller'
=>
[
0
=>
'application/json'
,
],
],
],
'zf-hal'
=>
[
...
...
@@ -596,6 +615,10 @@ return [
\
ImportData\V1\Rest\Acteur\ActeurResource
::
class
=>
[
'object_manager'
=>
'doctrine.entitymanager.orm_default'
,
'hydrator'
=>
'ImportData\\V1\\Rest\\Acteur\\ActeurHydrator'
,
'query_providers'
=>
[
'default'
=>
'default_orm'
,
'fetch_all'
=>
'acteur_fetch_all'
,
],
],
\
ImportData\V1\Rest\Role\RoleResource
::
class
=>
[
'object_manager'
=>
'doctrine.entitymanager.orm_default'
,
...
...
module/ImportData/src/V1/Rest/Acteur/ActeurFetchAll.php
0 → 100644
View file @
d1513ead
<?php
namespace
ImportData\V1\Rest\Acteur
;
use
Doctrine\ORM\EntityRepository
;
use
Doctrine\ORM\QueryBuilder
;
use
ZF\Apigility\Doctrine\Server\Query\Provider\AbstractQueryProvider
;
use
ZF\Rest\ResourceEvent
;
class
ActeurFetchAll
extends
AbstractQueryProvider
{
/**
* @param ResourceEvent $event
* @param string $entityClass
* @param array $parameters
* @return QueryBuilder
*/
public
function
createQuery
(
ResourceEvent
$event
,
$entityClass
,
$parameters
)
{
/** @var EntityRepository $repo */
$repo
=
$this
->
getObjectManager
()
->
getRepository
(
$entityClass
);
$qb
=
$repo
->
createQueryBuilder
(
'a'
);
if
(
isset
(
$parameters
[
'these_id'
]))
{
$qb
->
andWhere
(
'a.theseId = :theseId'
)
->
setParameter
(
'theseId'
,
$parameters
[
'these_id'
]);
}
return
$qb
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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