Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Cursor should be reset and limit should be restored after calling getSingleResult #68

Merged
merged 1 commit into from Sep 9, 2012

Conversation

Projects
None yet
3 participants
Contributor

Parad0X commented Aug 13, 2012

Currently calling getSingleResult leaves cursor in a weird state.
I think the following scenario makes sense

<?php

$document = $cursor->getSingleResult();
echo 'Newest document in this collection was created: ' . date('c', $document['created_at']->sec);

foreach ($cursor as $document) {
    // do something with a document
}

Currently if I try iterating over a cursor after calling getSingleResult I'm only going to get the second document in that cursor.

This pull request passes (merged e68e6df3 into fdf44d8).

This pull request passes (merged 80501e47 into fdf44d8).

This pull request passes (merged 5fb41c6 into fdf44d8).

jwage added a commit that referenced this pull request Sep 9, 2012

Merge pull request #68 from Parad0X/get-single-result-fix
Cursor should be reset and limit should be restored after calling getSingleResult

@jwage jwage merged commit b5ab03b into doctrine:master Sep 9, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment