/** * Returns the translation identified by $language * * Note, does not set $logo, the user should set this property himself * * @param mixed $data * @param mixed $language */ public function getTranslationFromArray($data, $language) { if ($language !== '') { $translation = $this->getTranslationFromLocale($language); if (is_null($translation)) { $translation = new CompanyI18n($language, $this); } $language = $language . '_'; // Translated properties $translation->setWebsite($this->updateIfSet($data[$language . 'website'], '')); $translation->setSlogan($this->updateIfSet($data[$language . 'slogan'], '')); $translation->setDescription($this->updateIfSet($data[$language . 'description'], '')); // Do not set logo, because most likely, $data[logo] is bogus. // Instead, the user should set this property himself later. return $translation; } }