Пример #1
0
 /**
  * @return LocalizedFallbackValue
  */
 public function getDefaultTitle()
 {
     $titles = $this->titles->filter(function (LocalizedFallbackValue $title) {
         return null === $title->getLocale();
     });
     if ($titles->count() != 1) {
         throw new \LogicException('There must be only one default title');
     }
     return $titles->first();
 }
Пример #2
0
 /**
  * @return LocalizedFallbackValue
  * @throws \LogicException
  */
 public function getDefaultDescription()
 {
     $descriptions = $this->descriptions->filter(function (LocalizedFallbackValue $description) {
         return null === $description->getLocale();
     });
     if ($descriptions->count() !== 1) {
         throw new \LogicException('There must be only one default description');
     }
     return $descriptions->first();
 }