[TYPO3-50-general] Finding objects in the Repository

Christoph Blömer chbloemer at gmx.net
Mon Dec 22 21:24:27 CET 2008

the current solution to find a task with a specific identifier is this:

    public function findTaskByIdentifier($identifier) {
        foreach($this->getClients() as $client) {
            foreach($client->getProjects() as $project){
                foreach($project->getTasks() as $task){
                    if ($task->getIdentifier() === $identifier) {
                        return $task;
        return NULL;

But this is very bad with the nested loops and takes some time.

I saw something in the blog example which uses some kind of query:
$query = $this->createQuery();
$blogs = $query->matching($query->equals('name', $name))->execute();

What is the best way to find a object from which i know the identifier?


More information about the TYPO3-project-5_0-general mailing list