Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443915
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443915
Commits
7bf0fbf4
Commit
7bf0fbf4
authored
14 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#902830
by bojanz: field_sql_storage() can't handle entityOrderBy (fatal error).
parent
d95f8cfd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/field/modules/field_sql_storage/field_sql_storage.module
+1
-1
1 addition, 1 deletion
.../field/modules/field_sql_storage/field_sql_storage.module
modules/simpletest/tests/entity_query.test
+127
-0
127 additions, 0 deletions
modules/simpletest/tests/entity_query.test
with
128 additions
and
1 deletion
modules/field/modules/field_sql_storage/field_sql_storage.module
+
1
−
1
View file @
7bf0fbf4
...
...
@@ -565,7 +565,7 @@ function field_sql_storage_field_storage_query(EntityFieldQuery $query) {
}
foreach
(
$query
->
entityOrder
as
$key
=>
$direction
)
{
$sql_field
=
$key
==
'entity_type'
?
'fcet.type'
:
"
$field_base_table
.
$key
"
;
$query
->
orderBy
(
$sql_field
,
$direction
);
$
select_
query
->
orderBy
(
$sql_field
,
$direction
);
}
return
$query
->
finishQuery
(
$select_query
,
$id_key
);
}
...
...
This diff is collapsed.
Click to expand it.
modules/simpletest/tests/entity_query.test
+
127
−
0
View file @
7bf0fbf4
...
...
@@ -291,6 +291,31 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
1
),
),
t
(
'Test sort entity entity_id in descending order.'
),
TRUE
);
// Test entity sort by entity_id, with a field condition.
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
entityOrderBy
(
'entity_id'
,
'ASC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity_bundle_key'
,
1
),
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
3
),
array
(
'test_entity_bundle_key'
,
4
),
),
t
(
'Test sort entity entity_id in ascending order, with a field condition.'
),
TRUE
);
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
propertyOrderBy
(
'ftid'
,
'DESC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity_bundle_key'
,
4
),
array
(
'test_entity_bundle_key'
,
3
),
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
1
),
),
t
(
'Test sort entity entity_id property in descending order, with a field condition.'
),
TRUE
);
// Test property sort by entity id.
$query
=
new
EntityFieldQuery
();
...
...
@@ -318,6 +343,31 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
1
),
),
t
(
'Test sort entity entity_id property in descending order.'
),
TRUE
);
// Test property sort by entity id, with a field condition.
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
propertyOrderBy
(
'ftid'
,
'ASC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity_bundle_key'
,
1
),
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
3
),
array
(
'test_entity_bundle_key'
,
4
),
),
t
(
'Test sort entity entity_id property in ascending order, with a field condition.'
),
TRUE
);
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
propertyOrderBy
(
'ftid'
,
'DESC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity_bundle_key'
,
4
),
array
(
'test_entity_bundle_key'
,
3
),
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
1
),
),
t
(
'Test sort entity entity_id property in descending order, with a field condition.'
),
TRUE
);
// Test entity sort by bundle.
$query
=
new
EntityFieldQuery
();
...
...
@@ -347,6 +397,33 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
1
),
),
t
(
'Test sort entity bundle in descending order.'
),
TRUE
);
// Test entity sort by bundle, with a field condition.
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
entityOrderBy
(
'bundle'
,
'ASC'
)
->
propertyOrderBy
(
'ftid'
,
'ASC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity_bundle_key'
,
1
),
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
3
),
array
(
'test_entity_bundle_key'
,
4
),
),
t
(
'Test sort entity bundle in ascending order, with a field condition.'
),
TRUE
);
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
entityOrderBy
(
'bundle'
,
'DESC'
)
->
propertyOrderBy
(
'ftid'
,
'DESC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity_bundle_key'
,
4
),
array
(
'test_entity_bundle_key'
,
3
),
array
(
'test_entity_bundle_key'
,
2
),
array
(
'test_entity_bundle_key'
,
1
),
),
t
(
'Test sort entity bundle in descending order, with a field condition.'
),
TRUE
);
// Test entity sort by revision_id.
$query
=
new
EntityFieldQuery
();
...
...
@@ -370,6 +447,31 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array
(
'test_entity'
,
2
),
array
(
'test_entity'
,
1
),
),
t
(
'Test sort entity revision_id in descending order.'
),
TRUE
);
// Test entity sort by revision_id, with a field condition.
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
entityOrderBy
(
'revision_id'
,
'ASC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity'
,
1
),
array
(
'test_entity'
,
2
),
array
(
'test_entity'
,
3
),
array
(
'test_entity'
,
4
),
),
t
(
'Test sort entity revision_id in ascending order, with a field condition.'
),
TRUE
);
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
entityOrderBy
(
'revision_id'
,
'DESC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity'
,
4
),
array
(
'test_entity'
,
3
),
array
(
'test_entity'
,
2
),
array
(
'test_entity'
,
1
),
),
t
(
'Test sort entity revision_id in descending order, with a field condition.'
),
TRUE
);
// Test property sort by revision_id.
$query
=
new
EntityFieldQuery
();
...
...
@@ -394,6 +496,31 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array
(
'test_entity'
,
1
),
),
t
(
'Test sort entity revision_id property in descending order.'
),
TRUE
);
// Test property sort by revision_id, with a field condition.
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
propertyOrderBy
(
'ftvid'
,
'ASC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity'
,
1
),
array
(
'test_entity'
,
2
),
array
(
'test_entity'
,
3
),
array
(
'test_entity'
,
4
),
),
t
(
'Test sort entity revision_id property in ascending order, with a field condition.'
),
TRUE
);
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity'
)
->
fieldCondition
(
$this
->
fields
[
0
],
'value'
,
0
,
'>'
)
->
propertyOrderBy
(
'ftvid'
,
'DESC'
);
$this
->
assertEntityFieldQuery
(
$query
,
array
(
array
(
'test_entity'
,
4
),
array
(
'test_entity'
,
3
),
array
(
'test_entity'
,
2
),
array
(
'test_entity'
,
1
),
),
t
(
'Test sort entity revision_id property in descending order, with a field condition.'
),
TRUE
);
$query
=
new
EntityFieldQuery
();
$query
->
entityCondition
(
'entity_type'
,
'test_entity_bundle_key'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment