function RulesIdentifiableDataWrapper::setData

Sets the data internally accepting both the data id and object.

3 calls to RulesIdentifiableDataWrapper::setData()
RulesIdentifiableDataWrapper::set in includes/rules.state.inc
Overridden to support setting the data by either the object or the id.
RulesIdentifiableDataWrapper::value in includes/rules.state.inc
Overridden.
RulesIdentifiableDataWrapper::__construct in includes/rules.state.inc
Construct a new wrapper object.

File

includes/rules.state.inc, line 708

Class

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

Code

protected function setData($data) {
    if (isset($data) && $data !== FALSE && !is_object($data)) {
        $this->id = $data;
        $this->data = FALSE;
    }
    elseif (is_object($data)) {
        // We got the data object passed.
        $this->data = $data;
        $id = $this->extractIdentifier($data);
        $this->id = isset($id) ? $id : FALSE;
    }
}