common/models/entities/User.php
public function validateSlugUpdate( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$existingUser = self::findBySlug( $this->slug );

			if( isset( $existingUser ) && $this->id != $existingUser->id ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_SLUG_EXIST ) );
			}
		}
	}
public function validateSlugUpdate( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$existingUser = self::findBySlug( $this->slug );

			if( isset( $existingUser ) && $this->id != $existingUser->id ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_SLUG_EXIST ) );
			}
		}
	}
public function validateSlugUpdate ( $ attribute , $ params ) { if ( ! $ this -> hasErrors ( ) ) { $ existingUser = self :: findBySlug ( $ this -> slug ) ; if ( isset ( $ existingUser ) && $ this -> id != $ existingUser -> id ) { $ this -> addError ( $ attribute , Yii :: $ app -> coreMessage -> getMessage ( CoreGlobal :: ERROR_SLUG_EXIST ) ) ; } } }
Validates user slug to ensure that only one user exist with the given slug.

@param type $attribute
@param type $params
@return void
Validates user slug to ensure that only one user exist with the given slug .