public function validateUniqueLink($attribute)
    {

        $params = Yii::$app->request->get();
        $query = PageLang::find()->joinWith('page')->andWhere([PageLang::tableName() . '.language' => Yii::$app->wavecms->editedLanguage, PageLang::tableName() . '.link' => $this->link]);

        if (isset($params['id'])) {
            $query->andWhere(['!=', Page::tableName() . '.id', $params['id']]);
        }

        if ($query->count() !== '0') {
            $this->addError($attribute, Yii::t('app', Yii::t('wavecms_page/main', 'Link should be unique.')));
        }
    }
public function validateUniqueLink($attribute)
    {

        $params = Yii::$app->request->get();
        $query = PageLang::find()->joinWith('page')->andWhere([PageLang::tableName() . '.language' => Yii::$app->wavecms->editedLanguage, PageLang::tableName() . '.link' => $this->link]);

        if (isset($params['id'])) {
            $query->andWhere(['!=', Page::tableName() . '.id', $params['id']]);
        }

        if ($query->count() !== '0') {
            $this->addError($attribute, Yii::t('app', Yii::t('wavecms_page/main', 'Link should be unique.')));
        }
    }
public function validateUniqueLink ( $ attribute ) { $ params = Yii :: $ app -> request -> get ( ) ; $ query = PageLang :: find ( ) -> joinWith ( 'page' ) -> andWhere ( [ PageLang :: tableName ( ) . '.language' => Yii :: $ app -> wavecms -> editedLanguage , PageLang :: tableName ( ) . '.link' => $ this -> link ] ) ; if ( isset ( $ params [ 'id' ] ) ) { $ query -> andWhere ( [ '!=' , Page :: tableName ( ) . '.id' , $ params [ 'id' ] ] ) ; } if ( $ query -> count ( ) !== '0' ) { $ this -> addError ( $ attribute , Yii :: t ( 'app' , Yii :: t ( 'wavecms_page/main' , 'Link should be unique.' ) ) ) ; } }
Validator for unique link per language
@param $attribute
@return void
Validator for unique link per language