Feature #1677

Query: add convenience method returning the first object of a result set

Added by Bastian Waidelich 89 days ago. Updated 77 days ago.

Status:New Start:2008-10-11
Priority:Could have Due date:
Assigned to:- % Done:

0%

Category:Persistence
Target version:-

Description

To retrieve one single object from a repository, one has to do something like this currently:

$objects = $query->execute();
if (count($objects) < 1) {
  return NULL;
}
return $objects[0];

Something like a "fetchOne()"-method in F3::TYPO3CR::Query::Query would be helpful:

$query->execute()->fetchOne();

or probably more like that

$query->fetchOne();

this could also set the limit to 1 to improve performance.


Related issues

related to Feature #1858 Persistence Framework Accepted 2008-10-27

History

2008-10-22 18:22 - Karsten Dambekalns

  • Project changed from TYPO3 CR to FLOW3
  • Category deleted (Query handling)

2008-10-22 18:23 - Karsten Dambekalns

  • Category set to Persistence

Also available in: Atom PDF