public function findAllBy(array $wheres, array $options = [])
    {
        $query = $this->getSqlObject()->select();

        $this->setColumns($query, $options);

        $wheres = $this->addJoins($query, $wheres, $options);

        $this->addWheres($query, $wheres, $options);

        $page = Arr::get($options, 'page');

        if ($page && !Arr::get($options, 'order')) {
            throw new LogicException('Must provide an ORDER BY if using pagination');
        }

        if (Arr::get($options, 'order')) {
            $this->setOrder($query, $options['order']);
        }

        if ($page) {
            $paginationData = $this->getPaginationData($query, $options);
            // Set LIMIT and OFFSET
            $query->limit($paginationData->getResultsPerPage());
            $query->offset(($page - 1) * $paginationData->getResultsPerPage());
        }

        $entityIterator = $this->executeAndGetResultsAsEntityIterator($query);

        if ($page) {
            $entityIterator->setPaginationData($paginationData);
        }

        return $entityIterator;
    }
public function findAllBy(array $wheres, array $options = [])
    {
        $query = $this->getSqlObject()->select();

        $this->setColumns($query, $options);

        $wheres = $this->addJoins($query, $wheres, $options);

        $this->addWheres($query, $wheres, $options);

        $page = Arr::get($options, 'page');

        if ($page && !Arr::get($options, 'order')) {
            throw new LogicException('Must provide an ORDER BY if using pagination');
        }

        if (Arr::get($options, 'order')) {
            $this->setOrder($query, $options['order']);
        }

        if ($page) {
            $paginationData = $this->getPaginationData($query, $options);
            // Set LIMIT and OFFSET
            $query->limit($paginationData->getResultsPerPage());
            $query->offset(($page - 1) * $paginationData->getResultsPerPage());
        }

        $entityIterator = $this->executeAndGetResultsAsEntityIterator($query);

        if ($page) {
            $entityIterator->setPaginationData($paginationData);
        }

        return $entityIterator;
    }
public function findAllBy ( array $ wheres , array $ options = [ ] ) { $ query = $ this -> getSqlObject ( ) -> select ( ) ; $ this -> setColumns ( $ query , $ options ) ; $ wheres = $ this -> addJoins ( $ query , $ wheres , $ options ) ; $ this -> addWheres ( $ query , $ wheres , $ options ) ; $ page = Arr :: get ( $ options , 'page' ) ; if ( $ page && ! Arr :: get ( $ options , 'order' ) ) { throw new LogicException ( 'Must provide an ORDER BY if using pagination' ) ; } if ( Arr :: get ( $ options , 'order' ) ) { $ this -> setOrder ( $ query , $ options [ 'order' ] ) ; } if ( $ page ) { $ paginationData = $ this -> getPaginationData ( $ query , $ options ) ; // Set LIMIT and OFFSET $ query -> limit ( $ paginationData -> getResultsPerPage ( ) ) ; $ query -> offset ( ( $ page - 1 ) * $ paginationData -> getResultsPerPage ( ) ) ; } $ entityIterator = $ this -> executeAndGetResultsAsEntityIterator ( $ query ) ; if ( $ page ) { $ entityIterator -> setPaginationData ( $ paginationData ) ; } return $ entityIterator ; }
Find all entities matching specific field values

@param  array $wheres  An array of where conditions in the format:
['column' => 'value'] or
['column', 'operator', 'value']
@param  array $options Array of options for this request.
May include 'order', 'page', or 'resultsPerPage'.
@return EntityIterator AbstractEntity objects
@throws LogicException If pagination enabled and no 'order' option specified.
Find all entities matching specific field values