Created
May 26, 2015 13:51
-
-
Save sam452/7e09a8a1223bc5292005 to your computer and use it in GitHub Desktop.
entity_field_query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EntityFieldQueryException: Unknown field: vunetid in EntityFieldQuery->addFieldCondition() (line 779 of /media/psf/Home/apps/newdom/includes/entity.inc). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function re_dashboard_my_list() { | |
// if (isset($_SESSION['vunetid'])) { | |
// # code... | |
// } else { | |
// re_dashboard_login_check(); | |
// drupal_set_message('VUNET id missing, please log in.'); | |
// } | |
$id = $_SESSION['vunetid']; | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node') | |
// ->entityCondition('type', 'redashboard_research_project') | |
->propertyCondition('type', 'redashboard_research_project') | |
// ->fieldCondition('field_news_types', 'value', 'spotlight', '=') | |
->fieldCondition('vunetid', 'value', $id, '=') | |
->addTag('efq_debug'); | |
// ->fieldCondition('field_faculty_tag', 'tid', $value) | |
// ->fieldCondition('field_news_publishdate', 'value', $year . '%', 'like') | |
// ->fieldOrderBy('field_photo', 'fid', 'DESC') | |
// ->range(0, 10) | |
// ->addMetaData('account', user_load(1)); // Run the query as user 1. | |
// $nodes = node_load_multiple(array(), array('type' => 'redashboard_research_project', 'field_vunetid_value' => $id)); | |
$result = $query->execute(); | |
$item_link = array(); | |
foreach ($result as $node) { | |
$item_link[] = l($node->title, 'node/'.$node->nid); | |
} | |
$output = theme('item_list', array('items' => $item_link)); | |
return $output; | |
} | |
function re_dashboard_query_alter($query) { | |
if ($query->hasTag('efq_debug') && module_exists('devel')) { | |
dpm((string) $query); | |
dpm($query->arguments()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment