简体   繁体   English

如何与persistent_object_identifier匹配?

[英]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? 我是否需要开启Yaml设置?

The idea was good. 这个主意很好。 But the table row persistent_object_identifier doesn't belong to the object itself. 但是表行的persistent_object_identifier不属于对象本身。 You can however use Persistence_Object_Identifier . 但是,您可以使用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. 并确保“ query in”的第二个参数是一个数组而不是单个字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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