Пример #1
0
 /**
  * Saves the data in the model
  * @param mixed $entry
  * @return nulls
  */
 public function saveEntry($entry)
 {
     if (!$this->willSave($entry)) {
         return;
     }
     // generate a name for the text
     if ($entry->getTitle()) {
         $entry->name = $entry->getTitle();
     } elseif ($entry->getBody()) {
         $strippedBody = strip_tags($entry->getBody());
         if ($strippedBody) {
             $body = $strippedBody;
         } else {
             $body = $entry->getBody();
         }
         $entry->name = StringHelper::truncate($body, 30);
     } elseif ($entry->getImage()) {
         $entry->name = $entry->getImage();
     } else {
         $entry->name = 'Text';
     }
     // perform the actual saving
     return parent::saveEntry($entry);
 }
 /**
  * Gathers the overview URL's for the provided entry
  * @param \ride\library\orm\model\GenericModel $model
  * @param \ride\library\orm\entry\Entry $entry
  * @return null
  */
 private function gatherOverviewUrls(GenericModel $model, $entry)
 {
     $locales = $model->getOrmManager()->getLocales();
     foreach ($locales as $locale) {
         $this->banUrls += $this->varnishInfo->getOverviewUrls($model->getName(), $locale, $this->baseUrl);
     }
 }
 /**
  * Saves the entry
  * @param mixed $entry
  * @return null
  */
 public function saveEntry($entry)
 {
     $entry->setPath($entry->generatePath());
     return parent::saveEntry($entry);
 }