Browse Source

LanguagesBehavior fix

master
Egorka 6 years ago
parent
commit
0fbb0d49d4
  1. 6
      core/behaviors/LanguageBehavior.php

6
core/behaviors/LanguageBehavior.php

@ -6,7 +6,6 @@
namespace core\behaviors;
use core\components\language\LanguageVirtualAbstract;
use yii\base\Behavior;
use yii\base\InvalidConfigException;
use yii\db\ActiveRecord;
@ -316,7 +315,7 @@ class LanguageBehavior extends Behavior
public function getTranslations()
{
/** @var ActiveRecord */
return $this->owner->hasMany($this->virtualClassName, [$this->relativeField => $this->ownerPrimaryKey]);
return $this->owner->hasMany($this->virtualClassName, [$this->relativeField => $this->_ownerPrimaryKey]);
}
public function getTranslation($language = null)
@ -335,7 +334,7 @@ class LanguageBehavior extends Behavior
$language = $translate ? $language : $this->defaultLanguage;
return $this->owner->hasOne($this->virtualClassName, [$this->relativeField => $this->ownerPrimaryKey])
return $this->owner->hasOne($this->virtualClassName, [$this->relativeField => $this->_ownerPrimaryKey])
->where([$this->languageField => $language]);
}
@ -359,5 +358,4 @@ class LanguageBehavior extends Behavior
{
return $this->hasLangAttribute($name) ? $this->_languageAttributes[$name] : null;
}
}

Loading…
Cancel
Save