function RulesState::save
Remembers to save the wrapper on cleanup or does it now.
2 calls to RulesState::save()
- RulesState::mergeSaveVariables in includes/
rules.state.inc - Merges info from the given state into the existing state.
- RulesState::saveChanges in includes/
rules.state.inc - Apply permanent changes provided the wrapper's data type is saveable.
File
-
includes/
rules.state.inc, line 202
Class
- RulesState
- The rules evaluation state.
Code
protected function save($selector, EntityMetadataWrapper $wrapper, $immediate) {
// Convert variable names and selectors to both use underscores.
$selector = strtr($selector, '-', '_');
if (isset($this->save[$selector])) {
if ($this->save[$selector][0]
->getIdentifier() == $wrapper->getIdentifier()) {
// The entity is already remembered. So do a combined save.
$this->save[$selector][1] += self::$blocked;
}
else {
// The wrapper is already in there, but wraps another entity. So first
// save the old one, then care about the new one.
$this->saveNow($selector);
}
}
if (!isset($this->save[$selector])) {
// In case of immediate saving don't clone the wrapper, so saving a new
// entity immediately makes the identifier available afterwards.
$this->save[$selector] = array(
$immediate ? $wrapper : clone $wrapper,
self::$blocked,
);
}
if ($immediate) {
$this->saveNow($selector);
}
}