I wrote a entity field query in my module, like this:
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'page')
->propertyCondition('status', 1)
->count();
$result = $query->execute();
But no matter how many page node is there, the $result is always 1, and no such issue without TAC module.
As I debug this with a debugger, it seems the cause is the hook_node_grants().
Without TAC, the finally sql is some thing like :
SELECT COUNT(*) AS expression
FROM
(SELECT 1 AS expression FROM .....
And with TAC :
SELECT COUNT(*) AS expression
FROM
(SELECT DISTINCT 1 AS expression FROM ....
So the result is 1 or 0, and the 'distinct' is added when noticing the hook_node_grants() ...
I don't know this is caused by myself or the incompleteness of entityfieldquery or the TAC...
It works well without 'count'.
Thanks
Comments
Comment #1
xjmInteresting. This is probably a core node access bug.
Possibly related issues:
Do you maybe want to try the patch in the first issue and see if it has any effect?
Comment #2
xjm