type = $type; } public function save($data = array()) { $data['updated_at'] = date('Y-m-d H:i:s'); $data['name'] = strtolower($this->name); if(!ZoneTypeEnum::isValidValue($this->type)) { throw new Exception('Invalid Zone Type ('. $this->type .')'); } if($this->type != ZoneTypeEnum::OTHER && empty($this->relid)) { throw new Exception('Zone relid cannto be empty when type is not empty'); } $this->name = strtolower($this->name); parent::save($data); } public function getRelatedItem() { $item = new RelatedItem($this->type, $this->relid, $this->clientid); return $item; } public function getPackageItem() { return $this->getRelatedItem()->getPackageItem(); } /** * @return main\models\custom\package\Package */ public function getPackage() { return $this->getRelatedItem()->getPackage(); } public function getServer() { return new Server($this->serverid); } public function setThatExist() { $this->status = 1; $this->save(); } public function setThatNotExist() { $this->status = 0; $this->save(); } public function setLocked() { $this->is_locked = 1; $this->save(); } public function setUnlocked() { $this->is_locked = 0; $this->save(); } /** @return SubmoduleAbstract */ public function getModule() { $server = $this->getServer(); $module = $server->getModule(); $module->setDomain($this->name); if($server->getSettings(ServerSettingEnum::ENABLE_CACHE) == 'on') { $module->enableCache($server->id, $this->name); } return $module; } }