Ojs\JournalBundle\Entity\PublisherTranslation::setName PHP Method

setName() public method

public setName ( string $name )
$name string
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }

Usage Example

コード例 #1
0
ファイル: Publisher.php プロジェクト: ojs/ojs
 /**
  * Translation helper method
  * @param null $locale
  * @return mixed|null|\Ojs\JournalBundle\Entity\PublisherTranslation
  */
 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;
     }
     $defaultTranslation = $this->translations->get($this->getDefaultLocale());
     if (!($translation = $this->translations->get($locale))) {
         $translation = new PublisherTranslation();
         if (!is_null($defaultTranslation)) {
             $translation->setAbout($defaultTranslation->getAbout());
             $translation->setName($defaultTranslation->getName());
         }
         $translation->setLocale($locale);
         $this->addTranslation($translation);
     }
     $this->currentTranslation = $translation;
     return $translation;
 }