public function save() { $this->hash = CryptoTool::sault(12); $this->scriptType = empty($this->scriptId) ? 'local' : 'scalr'; if (!isset($this->orderIndex)) { $this->orderIndex = 10; } if (!isset($this->issync)) { $this->issync = 0; } parent::save(); }
public function save() { $this->hash = CryptoTool::sault(12); parent::save(); }
/** * {@inheritdoc} * @see AbstractEntity::__set() */ public function __set($name, $value) { switch ($name) { case 'targets': if (!is_array($value)) { $value = (array) $value; } /* @var $farmRole FarmRole */ foreach (FarmRole::find([['id' => ['$in' => $value]]]) as $farmRole) { $target = new FarmRoleScriptingTarget(); $target->farmRoleScriptId =& $this->id; $target->targetType = OrchestrationRule::TARGET_ROLES; $target->target = $farmRole->alias; $this->_targets[$farmRole->id] = $target; } if ($notFound = array_diff_key(array_flip($value), $this->_targets)) { throw new InvalidEntityConfigurationException("Invalid target. Not found Farm Roles with IDs: [" . implode(', ', array_keys($notFound)) . "]"); } break; default: parent::__set($name, $value); } }