Search code examples
flow-framework

How can I match with the persistent_object_identifier?


Is there a way to use the query interface and limit the repository query by the persistent object identifier? Like ...

// $addTaskIds is an array with identifiers as strings
$query = $this->createQuery();
$query->matching(
    $query->logicalOr(
        $query->like('title', '%'.$searchstring.'%'),
        $query->like('description', '%'.$searchstring.'%'),
        $query->in('persistent_object_identifier', $addTaskIds)
    )
);
return $query->execute();

I've tried the code above and it doesn't work. Did I forgot something? Does the query builder offer that anyway? Do I have to switch on a yaml setting?


Solution

  • The idea was good. But the table row persistent_object_identifier doesn't belong to the object itself. You can however use Persistence_Object_Identifier.

    For that you need the identifiers as strings not as whole objects. And make sure that the second parameter of 'query in' is an array not a single string.