Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[DocumentRepository] Use Cursor::toArray() instead of iterator_to_array() #769

Merged
merged 1 commit into from

3 participants

@lemoinem

As per #752 (comment) by @tgabi333 and following. This replaces a direct call to iterator_to_array() by a call to Cursor::toArray() (DRY principal and better respect of encapsulation).

@jwage
Owner

This seems ok to me :+1: Thoughts @jmikola

@lemoinem lemoinem [DocumentRepository] Use Cursor::toArray() instead of iterator_to_arr…
…ay()

As per doctrine#752 (comment)
by @tgabi333 and following. This replaces a direct call to iterator_to_array by
a call to Cursor::toArray() (DRY principal and better respect of encapsulation).
a60114d
@lemoinem

Fixed typo in commit message (This replace => This replaces)

@jmikola jmikola merged commit f4a5623 into doctrine:master
@jmikola
Owner

Thanks, @lemoinem.

@lemoinem

My pleasure!

@lemoinem lemoinem deleted the lemoinem:fix/DRY-converting-cursor-to-array branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2014
  1. @lemoinem

    [DocumentRepository] Use Cursor::toArray() instead of iterator_to_arr…

    lemoinem authored
    …ay()
    
    As per doctrine#752 (comment)
    by @tgabi333 and following. This replaces a direct call to iterator_to_array by
    a call to Cursor::toArray() (DRY principal and better respect of encapsulation).
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/Doctrine/ODM/MongoDB/DocumentRepository.php
View
2  lib/Doctrine/ODM/MongoDB/DocumentRepository.php
@@ -170,7 +170,7 @@ public function findAll()
*/
public function findBy(array $criteria, array $sort = null, $limit = null, $skip = null)
{
- return iterator_to_array($this->getDocumentPersister()->loadAll($criteria, $sort, $limit, $skip), false);
+ return $this->getDocumentPersister()->loadAll($criteria, $sort, $limit, $skip)->toArray(false);
}
/**
Something went wrong with that request. Please try again.