API page: https://api.drupal.org/api/drupal/includes%21entity.inc/class/EntityFiel...
Enter a descriptive title (above) relating to class EntityFieldQuery, then describe the problem you have found:
I write a module centity, which create a custom entity type called "centity", and its table like :
$schema['centity'] = array(
'description' => 'Centity.',
'fields' => array(
'cid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique centity ID.',
),
'type' => array(
'description' => 'The {centity_type}.type of this centity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'type' => array('type'),
),
'primary key' => array('cid'),
);
$schema['centity_type'] = array(
'description' => 'Stores information about all defined {centity} types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique centity type identifier.',
),
'type' => array(
'description' => 'The machine-readable name of this centity type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this centity type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
) + entity_exportable_schema_fields(),
'primary key' => array('id'),
'unique keys' => array(
'type' => array('type'),
),
);
After enable centity, I create a bundle "special_join_record", and add two entityreference fields "field_special" and "field_user".
Then I create a "special_join_record" content.
Now I uninstall centity module, and install it again.
We know that table "centity" and "centity_type" are both empty.
But the two fields table, because I did't delete the content before uninstall centity module, shoud have a record like :
centity | special_join_record | 0 | 1 | 1 | und | 0 | 1225
Now I write a query using EntityFieldQuery:
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'centity')
->entityCondition('bundle', 'special_join_record');
$result = $query->execute();The result is empty, it' ok.
But when I write a query :
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'centity')
->entityCondition('bundle', 'special_join_record')
->fieldCondition('field_special', 'target_id', $special->nid->value(), '=')
->fieldCondition('field_user', 'target_id', $user->uid, '=');
$result = $query->execute();
The result has a record.
Table "centity" and "centity_type" are still empty.
I think this shoud be a bug.
Comments
Comment #1
rylynchen commentedComment #2
rylynchen commentedComment #3
jhodgdonThis looks like a code bug report and not a documentation bug, so changing component.
Either that or you just need some programming support... And although you can create issues in Drupal Core and mark the category as "support request", we don't really handle support requests in the Drupal Core issue queue as a regular practice (that option is mostly there for filing support issues for contributed modules and themes).
There are several support options listed if you click on "Support" at the top of Drupal.org, which will take you to:
http://drupal.org/support
There you can find out about the Drupal IRC channels, and the Forums, which are our two main support mechanisms in the Drupal community.
Anyway, please follow-up with this issue and maybe the maintainers of the entity system in Drupal 7 will be able to help you. If not, please try the support options. Good luck with your issue!
Comment #4
rylynchen commentedOK jhodgdon !
Thanks for your help !
Comment #5
rylynchen commented