common/services/traits/base/ApprovalTrait.php
public function getPageByAuthorityId( $id, $config = [] ) {

		$modelClass	= static::$modelClass;
		$modelTable	= $this->getModelTable();
		$query		= null;

		$owner = $config[ 'owner' ] ?? false;

		if( $owner ) {

			$query = $modelClass::queryWithOwnerAuthor();

			$query->andWhere( "$modelTable.holderId =:oid OR ($modelTable.holderId IS NULL AND $modelTable.createdBy =:cid )", [ ':oid' => $id, ':cid' => $id ] );
		}
		else {

			$query = $modelClass::queryWithAuthor();

			$query->andWhere( "$modelTable.createdBy =:cid", [ ':cid' => $id ] );
		}

		$config[ 'query' ] = $query;

		return $this->getPage( $config );
	}
public function getPageByAuthorityId( $id, $config = [] ) {

		$modelClass	= static::$modelClass;
		$modelTable	= $this->getModelTable();
		$query		= null;

		$owner = $config[ 'owner' ] ?? false;

		if( $owner ) {

			$query = $modelClass::queryWithOwnerAuthor();

			$query->andWhere( "$modelTable.holderId =:oid OR ($modelTable.holderId IS NULL AND $modelTable.createdBy =:cid )", [ ':oid' => $id, ':cid' => $id ] );
		}
		else {

			$query = $modelClass::queryWithAuthor();

			$query->andWhere( "$modelTable.createdBy =:cid", [ ':cid' => $id ] );
		}

		$config[ 'query' ] = $query;

		return $this->getPage( $config );
	}
public function getPageByAuthorityId ( $ id , $ config = [ ] ) { $ modelClass = static :: $ modelClass ; $ modelTable = $ this -> getModelTable ( ) ; $ query = null ; $ owner = $ config [ 'owner' ] ?? false ; if ( $ owner ) { $ query = $ modelClass :: queryWithOwnerAuthor ( ) ; $ query -> andWhere ( "$modelTable.holderId =:oid OR ($modelTable.holderId IS NULL AND $modelTable.createdBy =:cid )" , [ ':oid' => $ id , ':cid' => $ id ] ) ; } else { $ query = $ modelClass :: queryWithAuthor ( ) ; $ query -> andWhere ( "$modelTable.createdBy =:cid" , [ ':cid' => $ id ] ) ; } $ config [ 'query' ] = $ query ; return $ this -> getPage ( $ config ) ; }
It expects the model to support either createdBy or createdBy and ownerId columns
It expects the model to support either createdBy or createdBy and ownerId columns