Ojs\JournalBundle\Entity\ArticleTranslation::setKeywords PHP Метод

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

public setKeywords ( string $keywords )
$keywords string
    public function setKeywords($keywords)
    {
        $this->keywords = $keywords;
    }

Usage Example

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