I had a field using entity reference in my site. I'm trying to develop a module can read/use it.
$wrapper = entity_metadata_wrapper('node',$node);
dpm($wrapper->myRefField->getPropertyInfo());
This returns a error page, but dpm($wrapper->myRefField) shows that it's a standard EntityDrupalWrapper, though nothing in it.
How can I read $nid of the referenced node?
Errors below:
Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "node" does not exist LINE 3: node base ^: SELECT revision.vid AS vid, base.uid AS uid, revision.title AS title, revision.log AS log, revision.status AS status, revision.comment AS comment, revision.promote AS promote, revision.sticky AS sticky, base.nid AS nid, base.type AS type, base.language AS language, base.created AS created, base.changed AS changed, base.tnid AS tnid, base.translate AS translate, revision.timestamp AS revision_timestamp, revision.uid AS revision_uid FROM {node} base INNER JOIN {node_revision} revision ON revision.vid = base.vid WHERE (base.nid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 1 ) in DrupalDefaultEntityController->load() (line 191 of /var/www/site2/includes/entity.inc).
Additional
PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "filter_format" does not exist LINE 3: filter_format ff ^: SELECT ff.* FROM {filter_format} ff WHERE (status = :db_condition_placeholder_0) ORDER BY weight ASC; Array ( [:db_condition_placeholder_0] => 1 ) in filter_formats() (line 427 of /var/www/site2/modules/filter/filter.module).
Uncaught exception thrown in shutdown function.
PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "semaphore" does not exist LINE 1: DELETE FROM semaphore ^: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 18701629495353e89467a483.34692095 ) in lock_release_all() (line 269 of /var/www/site2/includes/lock.inc).
Uncaught exception thrown in session handler.
PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "sessions" does not exist LINE 3: sessions sessions ^: SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ); Array ( [:db_condition_placeholder_0] => sLS3fA1YAd1u1G6_xC1yxg0Ba6Kgrus6oXDBm4Wpuww [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 209 of /var/www/site2/includes/session.inc).
$node
is a valid node object?$wrapper->myRefField[0]->getPropertyInfo()