| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace MGModule\DNSManager2\models\custom\server\setting;
- use MGModule\DNSManager2 as main;
- /**
- * Log class
- *
- * @Table(name=serversetting)
- */
- class ServerSetting extends main\mgLibs\models\orm{
- /**
- * ID field
- *
- * @Column(id)
- * @var int
- */
- public $id;
-
- /**
- *
- * @Column(int=11, refrence=models\custom\server\Server::id,uniqueKey=1)
- * @var int
- */
- public $serverid;
-
- /**
- *
- * @Column(varchar,uniqueKey=1)
- * @var string
- */
- public $key;
-
- /**
- *
- * @Column(text)
- * @var string
- */
- public $value;
-
- public function __toString() {
- return $this->value;
- }
-
- public static function byServerAndKey($serverid, $key) {
- return Repository::factory()->byServerID($serverid)->byKey($key)->one();
- }
-
- public function getServer() {
- return new main\models\custom\server\Server($this->serverid);
- }
-
- public function save($data = array()){
- if(!ServerSettingEnum::isValidValue($this->key)) {
- throw new \Exception('Invalid Server Setting Key');
- }
- parent::save($data);
- }
- }
|