public function set($key, $value) { if ($this->key($key) == 'password') { $value = $this->generate_hash($value); } // Set return parent::set($key, $value); }
public function set($key, $value) { // Check in time: Convert Unix time to MySQL datetime if ($this->key($key) == 'checkInTime' && is_numeric($value) && strlen($value) == 10) { $value = $this->nice_date($value)->format('Y-m-d H:i:s'); } // Return return parent::set($key, $value); }
public function set($key, $value) { if ($this->key($key) == 'hosts' || $this->key($key) == 'hostsnotinme') { foreach ((array) $value as $Host) { $newValue[] = $Host instanceof Host ? $Host : new Host($Host); } $value = (array) $newValue; } // Set return parent::set($key, $value); }
public function set($key, $value) { if ($this->key($key) == 'hosts' || $this->key($key) == 'hostsnotinme') { foreach ((array) $value as $Host) { $newValue[] = $Host instanceof Host ? $Host : new Host($Host); } $value = (array) $newValue; } else { if ($this->key($key) == 'storageGroups') { foreach ((array) $value as $Group) { $newValue[] = $Group instanceof StorageGroup ? $Group : new Group($Group); } $value = (array) $newValue; } } // Set return parent::set($key, $value); }
public function set($key, $value) { // MAC Address if ($this->key($key) == 'mac') { $this->loadPrimary(); if (!$value instanceof MACAddress) { $value = new MACAddress($value); } } else { if ($this->key($key) == 'additionalMACs') { $this->loadAdditional(); foreach ((array) $value as $mac) { $newValue[] = $mac instanceof MACAddress ? $mac : new MACAddress($mac); } $value = (array) $newValue; } else { if ($this->key($key) == 'pendingMACs') { $this->loadPending(); foreach ((array) $value as $mac) { $newValue[] = $mac instanceof MACAddress ? $mac : new MACAddress($mac); } $value = (array) $newValue; } else { if (in_array($this->key($key), array('printers', 'printersnotinme'))) { $this->loadPrinters(); foreach ((array) $value as $printer) { $newValue[] = $printer instanceof Printer ? $printer : new Printer($printer); } $value = (array) $newValue; } else { if (in_array($this->key($key), array('snapins', 'snapinsnotinme'))) { $this->loadSnapins(); foreach ((array) $value as $snapin) { $newValue[] = $snapin instanceof Snapin ? $snapin : new Snapin($snapin); } $value = (array) $newValue; } else { if ($this->key($key) == 'snapinjob' && !$value instanceof SnapinJob) { $this->loadSnapinJob(); if (!$value instanceof SnapinJob) { $value = new SnapinJob($value); } } else { if ($this->key($key) == 'modules') { $this->loadModules(); foreach ((array) $value as $module) { $newValue[] = $module instanceof Module ? $module : new Module($module); } $value = (array) $newValue; } else { if ($this->key($key) == 'inventory') { $this->loadInventory(); if (!$value instanceof Inventory) { $value = new Inventory($value); } } else { if (in_array($this->key($key), array('groups', 'groupsnotinme'))) { $this->loadGroups(); foreach ((array) $value as $group) { $newValue[] = $group instanceof Group ? $group : new Group($group); } $value = (array) $newValue; } else { if ($this->key($key) == 'task') { $this->loadTask(); if (!$value instanceof Task) { $value = new Task($value); } } else { if ($this->key($key) == 'users') { $this->loadUsers(); foreach ((array) $value as $user) { $newValue[] = $user instanceof UserTracking ? $user : new UserTracking($user); } $value = (array) $newValue; } else { if ($this->key($key) == 'image') { if (!$value instanceof Image) { $value = new Image($value); } } } } } } } } } } } } } // Set return parent::set($key, $value); }