示例#1
0
文件: Record.php 项目: gudwin/extasy
 public function insert()
 {
     parent::insert();
     if (empty($this->log)) {
         if (!$this->log_id->getValue()) {
             throw new \NotFoundException('Log record not set. Record can`t be added ');
         }
         $this->log = new Log();
         $this->log->get($this->log_id->getValue());
     }
     if ($this->log->critical->getValue()) {
         $this->sendEmailNotification();
     }
 }
示例#2
0
文件: Log.php 项目: gudwin/extasy
 /**
  * @param $id
  *
  * @return Log
  */
 public static function getById($id)
 {
     $result = new Log();
     $found = $result->get($id);
     if (empty($found)) {
         throw new \NotFoundException('Log record not found');
     }
     return $result;
 }
示例#3
0
 public function testSetupLogging()
 {
     $api = new EditLog(array('name' => 'Log1', 'enable_logging' => 0));
     $api->exec();
     $log = new Log();
     $log->get(1);
     $this->assertEquals(0, $log->enable_logging->getValue());
     $api = new EditLog(array('name' => 'Log1', 'enable_logging' => 1));
     $api->exec();
     //
     $log = new Log();
     $log->get(1);
     $this->assertEquals(1, $log->enable_logging->getValue());
 }