function RulesIdentifiableDataWrapper::set

Overridden to support setting the data by either the object or the id.

File

includes/rules.state.inc, line 746

Class

RulesIdentifiableDataWrapper
A wrapper class similar to the EntityDrupalWrapper, but for non-entities.

Code

public function set($value) {
  if (!$this->validate($value)) {
    throw new EntityMetadataWrapperException('Invalid data value given. Be sure it matches the required data type and format.');
  }
  // As custom wrapper classes can only appear for Rules variables, but not
  // as properties we don't have to care about updating the parent.
  $this->clear();
  $this->setData($value);
  return $this;
}