common/services/base/ActiveRecordService.php
public static function findPage( $config = [] ) {

		$modelClass	= static::$modelClass;
		$modelTable = $modelClass::tableName();

		$sort = isset( $config[ 'sort' ] ) ? $config[ 'sort' ] : false;

		// Default sort
		if( !$sort ) {

			$defaultSort = isset( $config[ 'defaultSort' ] ) ? $config[ 'defaultSort' ] : [ 'id' => SORT_DESC ];

			$sort = new Sort([
				'attributes' => [
					'id' => [
						'asc' => [ "$modelTable.id" => SORT_ASC ],
						'desc' => [ "$modelTable.id" => SORT_DESC ],
						'default' => SORT_DESC,
						'label' => 'Id'
					]
				],
				'defaultOrder' => $defaultSort
			]);

			$config[ 'sort' ] = $sort;
		}

		// Default conditions
		$config[ 'conditions' ] = $config[ 'conditions' ] ?? [];

		// Default query
		if( !isset( $config[ 'query' ] ) ) {

			$modelClass	= static::$modelClass;
			$hasOne		= isset( $config[ 'hasOne' ] ) ? $config[ 'hasOne' ] : false;

			if( $hasOne ) {

				$config[ 'query' ] = $modelClass::queryWithHasOne();
			}
		}

		// Filters
		$config	= static::applyPublicFilters( $config );

		$config	= static::applySiteFilters( $config );

		// Default search column
		if( !isset( $config[ 'search-col' ] ) ) {

			$config[ 'search-col' ][] = "$modelTable.id";
		}

		return static::findDataProvider( $config );
	}
public static function findPage( $config = [] ) {

		$modelClass	= static::$modelClass;
		$modelTable = $modelClass::tableName();

		$sort = isset( $config[ 'sort' ] ) ? $config[ 'sort' ] : false;

		// Default sort
		if( !$sort ) {

			$defaultSort = isset( $config[ 'defaultSort' ] ) ? $config[ 'defaultSort' ] : [ 'id' => SORT_DESC ];

			$sort = new Sort([
				'attributes' => [
					'id' => [
						'asc' => [ "$modelTable.id" => SORT_ASC ],
						'desc' => [ "$modelTable.id" => SORT_DESC ],
						'default' => SORT_DESC,
						'label' => 'Id'
					]
				],
				'defaultOrder' => $defaultSort
			]);

			$config[ 'sort' ] = $sort;
		}

		// Default conditions
		$config[ 'conditions' ] = $config[ 'conditions' ] ?? [];

		// Default query
		if( !isset( $config[ 'query' ] ) ) {

			$modelClass	= static::$modelClass;
			$hasOne		= isset( $config[ 'hasOne' ] ) ? $config[ 'hasOne' ] : false;

			if( $hasOne ) {

				$config[ 'query' ] = $modelClass::queryWithHasOne();
			}
		}

		// Filters
		$config	= static::applyPublicFilters( $config );

		$config	= static::applySiteFilters( $config );

		// Default search column
		if( !isset( $config[ 'search-col' ] ) ) {

			$config[ 'search-col' ][] = "$modelTable.id";
		}

		return static::findDataProvider( $config );
	}
public static function findPage ( $ config = [ ] ) { $ modelClass = static :: $ modelClass ; $ modelTable = $ modelClass :: tableName ( ) ; $ sort = isset ( $ config [ 'sort' ] ) ? $ config [ 'sort' ] : false ; // Default sort if ( ! $ sort ) { $ defaultSort = isset ( $ config [ 'defaultSort' ] ) ? $ config [ 'defaultSort' ] : [ 'id' => SORT_DESC ] ; $ sort = new Sort ( [ 'attributes' => [ 'id' => [ 'asc' => [ "$modelTable.id" => SORT_ASC ] , 'desc' => [ "$modelTable.id" => SORT_DESC ] , 'default' => SORT_DESC , 'label' => 'Id' ] ] , 'defaultOrder' => $ defaultSort ] ) ; $ config [ 'sort' ] = $ sort ; } // Default conditions $ config [ 'conditions' ] = $ config [ 'conditions' ] ?? [ ] ; // Default query if ( ! isset ( $ config [ 'query' ] ) ) { $ modelClass = static :: $ modelClass ; $ hasOne = isset ( $ config [ 'hasOne' ] ) ? $ config [ 'hasOne' ] : false ; if ( $ hasOne ) { $ config [ 'query' ] = $ modelClass :: queryWithHasOne ( ) ; } } // Filters $ config = static :: applyPublicFilters ( $ config ) ; $ config = static :: applySiteFilters ( $ config ) ; // Default search column if ( ! isset ( $ config [ 'search-col' ] ) ) { $ config [ 'search-col' ] [ ] = "$modelTable.id" ; } return static :: findDataProvider ( $ config ) ; }
The method findPage provide data provider after generating appropriate query.
It uses find or queryWithHasOne as default method to generate base query.
The method findPage provide data provider after generating appropriate query . It uses find or queryWithHasOne as default method to generate base query .