common/models/traits/mappers/ModelFollowerTrait.php
protected function generateUserFollows() {

		$user		= Yii::$app->user->identity;
		$returnArr	= [ IFollower::TYPE_LIKE => false, IFollower::TYPE_DISLIKE => false, IFollower::TYPE_FOLLOW => false, IFollower::TYPE_WISHLIST => false ];

		if( isset( $user ) ) {

			$followerTable	= ModelFollower::tableName();
			$query			= new Query();

	    	$query->select( [ 'type', 'active' ] )
					->from( $followerTable )
					->where( [ 'parentId' => $this->id, 'parentType' => $this->modelType, 'modelId' => $user->id ] );

			$follows = $query->all();

			foreach ( $follows as $follow ) {

				$returnArr[ $follow[ 'type' ] ] = $follow[ 'active' ];
			}
		}

		return $returnArr;
	}
protected function generateUserFollows() {

		$user		= Yii::$app->user->identity;
		$returnArr	= [ IFollower::TYPE_LIKE => false, IFollower::TYPE_DISLIKE => false, IFollower::TYPE_FOLLOW => false, IFollower::TYPE_WISHLIST => false ];

		if( isset( $user ) ) {

			$followerTable	= ModelFollower::tableName();
			$query			= new Query();

	    	$query->select( [ 'type', 'active' ] )
					->from( $followerTable )
					->where( [ 'parentId' => $this->id, 'parentType' => $this->modelType, 'modelId' => $user->id ] );

			$follows = $query->all();

			foreach ( $follows as $follow ) {

				$returnArr[ $follow[ 'type' ] ] = $follow[ 'active' ];
			}
		}

		return $returnArr;
	}
protected function generateUserFollows ( ) { $ user = Yii :: $ app -> user -> identity ; $ returnArr = [ IFollower :: TYPE_LIKE => false , IFollower :: TYPE_DISLIKE => false , IFollower :: TYPE_FOLLOW => false , IFollower :: TYPE_WISHLIST => false ] ; if ( isset ( $ user ) ) { $ followerTable = ModelFollower :: tableName ( ) ; $ query = new Query ( ) ; $ query -> select ( [ 'type' , 'active' ] ) -> from ( $ followerTable ) -> where ( [ 'parentId' => $ this -> id , 'parentType' => $ this -> modelType , 'modelId' => $ user -> id ] ) ; $ follows = $ query -> all ( ) ; foreach ( $ follows as $ follow ) { $ returnArr [ $ follow [ 'type' ] ] = $ follow [ 'active' ] ; } } return $ returnArr ; }
Generate and return the user follows.

@return array
Generate and return the user follows .