Ojs\JournalBundle\Entity\SubjectTranslation::setDescription PHP Метод

setDescription() публичный Метод

public setDescription ( string $description )
$description string
    public function setDescription($description)
    {
        $this->description = $description;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Translation helper method
  * @param null $locale
  * @return mixed|null|\Ojs\JournalBundle\Entity\SubjectTranslation
  */
 public function translate($locale = null)
 {
     if (null === $locale) {
         $locale = $this->currentLocale;
     }
     if (!$locale && $this->parent !== null) {
         $locale = $this->parent->getCurrentLocale();
     }
     if (!$locale) {
         throw new \RuntimeException('No locale has been set and currentLocale is empty');
     }
     /** @var SubjectTranslation $currentTranslation */
     $currentTranslation = $this->currentTranslation;
     if ($currentTranslation && $currentTranslation->getLocale() === $locale) {
         return $currentTranslation;
     }
     /** @var SubjectTranslation $defaultTranslation */
     $defaultTranslation = $this->translations->get($this->getDefaultLocale());
     if (!($translation = $this->translations->get($locale))) {
         $translation = new SubjectTranslation();
         if (!is_null($defaultTranslation)) {
             $translation->setSubject($defaultTranslation->getSubject());
             $translation->setDescription($defaultTranslation->getDescription());
         }
         $translation->setLocale($locale);
         $this->addTranslation($translation);
     }
     $this->currentTranslation = $translation;
     return $translation;
 }