You are here

public function RulesIdentifiableDataWrapper::set in Rules 7.2

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

Overrides EntityMetadataWrapper::set

File

includes/rules.state.inc, line 734
Contains the state and data related stuff.

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;
}