Skip to content

Commit

Permalink
Merge branch 'release/1.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
devsdmf committed Mar 18, 2016
2 parents b5ae248 + b8452ec commit ed08804
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,4 +1,6 @@
# CHANGELOG
- `1.1.3`
* Fixed a bug when a limit and/or offset parameters in fetch method is not a literal integer
- `1.1.2`
* Fixed entity mapping bug that causes to mapper index properties without @db_ref annotation
- `1.1.1`
Expand Down
2 changes: 1 addition & 1 deletion src/DataMonkey/Entity/Exception/InvalidEntityException.php
Expand Up @@ -11,4 +11,4 @@
*/
class InvalidEntityException extends \RuntimeException
{
}
}
Expand Up @@ -11,4 +11,4 @@
*/
class InvalidStrategyException extends \RuntimeException
{
}
}
Expand Up @@ -11,4 +11,4 @@
*/
class InvalidPrimaryKeyException extends \RuntimeException
{
}
}
8 changes: 4 additions & 4 deletions src/DataMonkey/Repository/Repository.php
Expand Up @@ -75,12 +75,12 @@ public function fetch($criteria = null, array $orderBy = null, $limit = null, $o
}

// Preparing limit statement
if (!is_null($limit)) {
if (!is_null($limit) && (int) $limit > 0) {
$limit_statement = ' LIMIT ';
if (is_null($offset)) {
$limit_statement .= $limit;
if (!is_null($offset) && (int) $offset > 0) {
$limit_statement .= (int) $offset . ',' . $limit;
} else {
$limit_statement .= $offset . ',' . $limit;
$limit_statement .= (int) $limit;
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/DataMonkey/Repository/RepositoryInterface.php
Expand Up @@ -16,10 +16,10 @@ interface RepositoryInterface
/**
* Fetch objects from database
*
* @param array|ExportableEntity $criteria
* @param array $orderBy
* @param integer $limit
* @param integer $offset
* @param array|ExportableEntity $criteria
* @param array $orderBy
* @param integer $limit
* @param integer $offset
* @return \DataMonkey\Repository\ResultStack
*/
public function fetch($criteria = null, array $orderBy = null, $limit = null, $offset = null);
Expand All @@ -34,10 +34,10 @@ public function fetchAll();
/**
* Fetch objects by a set of criteria
*
* @param array $criteria
* @param array $orderBy
* @param integer $limit
* @param integer $offset
* @param array $criteria
* @param array $orderBy
* @param integer $limit
* @param integer $offset
* @return \DataMonkey\Repository\ResultStack
*/
public function fetchBy(array $criteria, array $orderBy = null, $limit = null, $offset = null);
Expand Down

0 comments on commit ed08804

Please sign in to comment.