typo3-flow

How can i write a query that returns all objects except a given one?


im trying to write a simple query that would be easy if i had access to the persistence_object_identifier. I kickstarted my models and so i dont have them.

What i want to do is:

function getAllExcept($obj){
  $query = $this->createQuery();
  $query->matching(
     $query->logicalNot(
         $query->equals('persistence_object_identifier', $obj)
     )             
    );
  return $query->execute();
}

I tried a lot but i cannot make it work. I could easily call ->toArray() and filter the one object out, but the fluid pagination widget needs the QueryResultInterface...


Solution

  • The property's name is Persistence_Object_Identifier (mind the case). It is injected by AOP in https://git.typo3.org/Packages/TYPO3.Flow.git/blob/HEAD:/Classes/TYPO3/Flow/Persistence/Aspect/PersistenceMagicAspect.php#l58.