Raxter Posted February 17, 2017 Share Posted February 17, 2017 I am in need of serious help. I have been working on this issue and researching for weeks. I am using entity metadata wrapper to update a time value. I am not encountering any errors. It is just not updating. I am using set() to update the value. Any ideas or input?? This is when the original value is set in the node: $node->field_event_dates[$node->language][0]['value2'] = strtotime($event->endTime); When I try to update the endtime, nothing updates: $feed_data = $json_data->dissertations; foreach ($feed_data as $event) { // make sure it doesn't already exist $event_nids = FALSE; $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', 'event') ->propertyCondition('field_form_id', $event->{'form_id'}, '=') ->fieldCondition('field_event_dates', 'value', strtotime($event->startTime) , '=') ->range(0, 1) //($start, $length) ->addMetaData('account', user_load(1)); // Run the query as user 1. $result = $query->execute(); if (isset($result['node'])) { // existing so update $counter_existing++; //added to update event when a change $node = node_load($nid); $node_wrapper = entity_metadata_wrapper('node', $node); $node_wrapper->field_event_dates->set(array('value2'=> strtotime($event->endTime))); $node_wrapper->save(); } Quote Link to comment https://forums.phpfreaks.com/topic/303219-drupal-7-entity_metadata_wrapper-not-updating/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.