@@ 1980-2005 (lines=26) @@ | ||
1977 | * @param ConnectionInterface $con an optional connection object |
|
1978 | * |
|
1979 | * @return ChildBannerImageI18n */ |
|
1980 | public function getTranslation($locale = 'ru', ConnectionInterface $con = null) |
|
1981 | { |
|
1982 | if (!isset($this->currentTranslations[$locale])) { |
|
1983 | if (null !== $this->collBannerImageI18ns) { |
|
1984 | foreach ($this->collBannerImageI18ns as $translation) { |
|
1985 | if ($translation->getLocale() == $locale) { |
|
1986 | $this->currentTranslations[$locale] = $translation; |
|
1987 | ||
1988 | return $translation; |
|
1989 | } |
|
1990 | } |
|
1991 | } |
|
1992 | if ($this->isNew()) { |
|
1993 | $translation = new ChildBannerImageI18n(); |
|
1994 | $translation->setLocale($locale); |
|
1995 | } else { |
|
1996 | $translation = ChildBannerImageI18nQuery::create() |
|
1997 | ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) |
|
1998 | ->findOneOrCreate($con); |
|
1999 | $this->currentTranslations[$locale] = $translation; |
|
2000 | } |
|
2001 | $this->addBannerImageI18n($translation); |
|
2002 | } |
|
2003 | ||
2004 | return $this->currentTranslations[$locale]; |
|
2005 | } |
|
2006 | ||
2007 | /** |
|
2008 | * Remove the translation for a given locale |
@@ 1928-1953 (lines=26) @@ | ||
1925 | * @param ConnectionInterface $con an optional connection object |
|
1926 | * |
|
1927 | * @return ChildBannersI18n */ |
|
1928 | public function getTranslation($locale = 'ru', ConnectionInterface $con = null) |
|
1929 | { |
|
1930 | if (!isset($this->currentTranslations[$locale])) { |
|
1931 | if (null !== $this->collBannersI18ns) { |
|
1932 | foreach ($this->collBannersI18ns as $translation) { |
|
1933 | if ($translation->getLocale() == $locale) { |
|
1934 | $this->currentTranslations[$locale] = $translation; |
|
1935 | ||
1936 | return $translation; |
|
1937 | } |
|
1938 | } |
|
1939 | } |
|
1940 | if ($this->isNew()) { |
|
1941 | $translation = new ChildBannersI18n(); |
|
1942 | $translation->setLocale($locale); |
|
1943 | } else { |
|
1944 | $translation = ChildBannersI18nQuery::create() |
|
1945 | ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) |
|
1946 | ->findOneOrCreate($con); |
|
1947 | $this->currentTranslations[$locale] = $translation; |
|
1948 | } |
|
1949 | $this->addBannersI18n($translation); |
|
1950 | } |
|
1951 | ||
1952 | return $this->currentTranslations[$locale]; |
|
1953 | } |
|
1954 | ||
1955 | /** |
|
1956 | * Remove the translation for a given locale |