You are here

public function EntityListWrapper::set in Entity API 7

Set a new data value.

Overrides EntityMetadataWrapper::set

3 calls to EntityListWrapper::set()
EntityListWrapper::offsetUnset in includes/entity.wrapper.inc
EntityListWrapper::setProperty in includes/entity.wrapper.inc
EntityListWrapper::__construct in includes/entity.wrapper.inc
Construct a new wrapper object.

File

includes/entity.wrapper.inc, line 1108
Provides wrappers allowing easy usage of the entity metadata.

Class

EntityListWrapper
Wraps a list of values.

Code

public function set($values) {

  // Support setting lists of fully loaded entities.
  if ($this->isEntityList && $values && is_object(reset($values))) {
    foreach ($values as $key => $value) {

      // Ignore outdated NULL value references in lists of entities.
      if (isset($value)) {
        list($id, $vid, $bundle) = entity_extract_ids($this->itemType, $value);
        $values[$key] = $id;
      }
    }
  }
  return parent::set($values);
}