Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
Query: iterating of Query object throws exception
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Jul 11, 2016
1 parent 6127fdd commit 8ecb1f4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Exception/NotImplementedException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

/**
* This file is part of the Inlm\QueryObject extension
* for the Lean Mapper library (http://leanmapper.com)
*/

namespace Inlm\QueryObject\Exception;

class NotImplementedException extends Exception
{
}
33 changes: 32 additions & 1 deletion src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Inlm\QueryObject\Exception\InvalidStateException;
use Inlm\QueryObject\Exception\MemberAccessException;
use Inlm\QueryObject\Exception\NonExistingMethodException;
use Inlm\QueryObject\Exception\NotImplementedException;

/**
* @author Michal Bohuslávek
Expand All @@ -30,7 +31,7 @@
* @method Query limit(int $limit)
* @method Query offset(int $offset)
*/
class Query implements IQuery
class Query implements IQuery, \Iterator
{
/** @var string */
private static $defaultPlaceholder = '?';
Expand Down Expand Up @@ -576,4 +577,34 @@ private function commandOffset($offset)
$this->fluent->offset($offset);
}

/****************** Iterator ******************/
public function current()
{
throw new NotImplementedException("Query object is not iterable.");
}


public function next()
{
throw new NotImplementedException("Query object is not iterable.");
}


public function rewind()
{
throw new NotImplementedException("Query object is not iterable.");
}


public function key()
{
throw new NotImplementedException("Query object is not iterable.");
}


public function valid()
{
throw new NotImplementedException("Query object is not iterable.");
}

}

0 comments on commit 8ecb1f4

Please sign in to comment.