在 DoctrineORMPersistentCollection 中定义自定义方法



我正在获取具有多对多关系的数据,我想定义一个自定义方法。是否有可能(以及如何)使用类似的东西:

$hotel = $entityManager->getRepository('Hotels')->findOneById(1);
$types = $hotel->getTypes(); //$types is instance of **DoctrineORMPersistentCollection**
$types->myCustomFunction(); //do something

它似乎还没有实现。

请参阅本教义的JIRA问题:http://www.doctrine-project.org/jira/browse/DDC-547

考虑允许自定义持久集合实现

我们应该考虑允许在每个关联的基础上配置自定义 PersistentCollection 实现。 这允许用户为其某些集合创建优化的 (SQL) 行为,以提高性能,而无需更改域模型代码。

为此,需要为继承设计 PersistentCollection。

最新更新