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
6a3db839
Commit
6a3db839
authored
Nov 27, 2018
by
Bernhard Schussek
Browse files
Made ordering resilient against wrong field names
parent
9a66e08a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Repository/ORMRepository.php
View file @
6a3db839
...
...
@@ -773,8 +773,13 @@ abstract class ORMRepository extends EntityRepository implements EditableReposit
protected
function
addOrderByCriteria
(
QueryBuilder
$qb
,
string
$alias
,
Order
$order
):
void
{
// TODO could we just order by the offset if there is one?
$classMetadata
=
$this
->
getClassMetadata
();
foreach
(
$order
->
getDirections
()
as
$fieldName
=>
$direction
)
{
if
(
!
$classMetadata
->
hasField
(
$fieldName
))
{
continue
;
}
$qb
->
addOrderBy
(
sprintf
(
'%s.%s'
,
$alias
,
$fieldName
),
$direction
...
...
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