Beispiel #1
0
 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();
 }
Beispiel #2
0
 public function save()
 {
     $this->hash = CryptoTool::sault(12);
     parent::save();
 }
Beispiel #3
0
 /**
  * {@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);
     }
 }