Feature #1677
Query: add convenience method returning the first object of a result set
| Status: | Resolved | Start date: | 2008-10-11 | |
|---|---|---|---|---|
| Priority: | Could have | Due date: | ||
| Assigned To: | Karsten Dambekalns | % Done: | 100% |
|
| Category: | Persistence | |||
| Target version: | - | |||
| PHP Version: | Complexity: | |||
| Has patch: |
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
History
#1 Updated by Karsten Dambekalns almost 7 years ago
- Project changed from TYPO3.TYPO3CR to TYPO3.Flow
- Category deleted (
Query handling)
#2 Updated by Karsten Dambekalns almost 7 years ago
- Category set to Persistence
#3 Updated by Karsten Dambekalns over 6 years ago
- Status changed from New to Resolved
- Assigned To set to Karsten Dambekalns
- % Done changed from 0 to 100
I consider this resolved as of changeset r1890 by Robert Lemke.