简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM