Feature #1677
Query: add convenience method returning the first object of a result set
| 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.