Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CWD
CwdDataDoctrineORMBundle
Commits
84f3d94a
Commit
84f3d94a
authored
Sep 10, 2018
by
Bernhard Schussek
Browse files
Added extensions from NEOS CRM
parent
8e5557e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Repository/ORMRepository.php
View file @
84f3d94a
...
...
@@ -126,6 +126,7 @@ abstract class ORMRepository extends EntityRepository implements EditableReposit
return
new
EmptyCursor
();
}
// Index by ID for the ID check below
$results
=
$this
->
createQueryBuilder
(
'e'
,
sprintf
(
'e.%s'
,
$this
->
idField
))
->
where
(
sprintf
(
'e.%s IN (:ids)'
,
$this
->
idField
))
->
setParameter
(
'ids'
,
array_map
(
'strval'
,
array_values
(
$ids
)))
...
...
@@ -146,6 +147,25 @@ abstract class ORMRepository extends EntityRepository implements EditableReposit
return
new
ArrayCursor
(
array_values
(
$results
));
}
/**
* {@inheritdoc}
*/
public
function
getMultipleBy
(
array
$fieldValues
):
Cursor
{
if
(
0
===
count
(
$fieldValues
))
{
return
new
EmptyCursor
();
}
$qb
=
$this
->
createQueryBuilder
(
'e'
);
foreach
(
$fieldValues
as
$fieldName
=>
$fieldValue
)
{
$qb
->
andWhere
(
sprintf
(
'e.%s = :%s'
,
$fieldName
,
$fieldName
))
->
setParameter
(
$fieldName
,
$fieldValue
);
}
return
new
ArrayCursor
(
array_values
(
$qb
->
getQuery
()
->
execute
()));
}
/**
* {@inheritdoc}
*/
...
...
@@ -434,7 +454,8 @@ abstract class ORMRepository extends EntityRepository implements EditableReposit
*/
protected
function
fetchFieldValues
(
string
$fieldName
,
array
$ids
=
[]):
array
{
$qb
=
$this
->
createQueryBuilder
(
'c'
)
->
select
(
sprintf
(
'c.%s, c.%s'
,
$this
->
idField
,
$fieldName
));
$qb
=
$this
->
createQueryBuilder
(
'c'
)
->
select
(
sprintf
(
'c.%s, c.%s'
,
$this
->
idField
,
$fieldName
));
if
(
count
(
$ids
)
>
0
)
{
$qb
->
where
(
sprintf
(
'c.%s IN (:ids)'
,
$this
->
idField
))
...
...
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