Пример #1
0
 protected function autoCreate()
 {
     $modelClass = $this->fieldInfo['model'];
     if (empty($this->aValue)) {
         $this->linkedModel = new $modelClass();
         $this->linkedModel->insert();
     } else {
         $this->linkedModel = call_user_func([$modelClass, 'getById'], $this->aValue);
     }
 }
Пример #2
0
 public function insert()
 {
     $avatarPath = self::DefaultAvatarPath;
     $result = parent::insert();
     $this->avatar = $avatarPath;
     $this->update();
     return $result;
 }
Пример #3
0
 public function insert()
 {
     $condition = array('class' => $this->class->getValue(), 'hash' => $this->hash->getValue(), 'status' => self::NewStatus);
     $found = DBSimple::get(self::TableName, $condition);
     if (!empty($found)) {
         $this->setData($found);
     } else {
         parent::insert();
     }
 }
Пример #4
0
 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();
     }
 }
Пример #5
0
 /**
  *
  * @param int $parentSitemapId индекс в таблице sitemap
  *
  * @see Document::insert()
  */
 public function insert($parentSitemapId = 0)
 {
     $result = parent::insert();
     if ($this->withSitemap) {
         // Получаем сайтмап данные
         $sitemapInfo = $this->returnSitemapParams();
         // Добавляем
         Sitemap::addPage($sitemapInfo['name'], $sitemapInfo['url_key'], static::ModelName, $this->id->getValue(), $parentSitemapId);
         // Загружаем
         $this->needSitemapData();
     }
     //
     return $result;
 }