/**
  * @inheritdoc
  */
 public function down()
 {
     $this->dropTable(Language::tableName());
 }
Exemplo n.º 2
0
 /**
  * Relation to model translation
  *
  * @param $locale
  * @return ActiveQuery
  */
 public function getTranslation($locale = null)
 {
     $locale = $locale ?: Yii::$app->language;
     return $this->owner->hasOne($this->translationModelName, [$this->translationOwnerField => $this->ownerPrimaryKey])->from(['content' => call_user_func([$this->translationModelName, 'tableName'])])->innerJoin(['lang' => Language::tableName()])->where('lang.locale = :locale', [':locale' => $locale])->andWhere('content.' . $this->owner->getDb()->quoteColumnName($this->languageField) . ' = lang.id');
 }