不知道我做了什么..。但是现在我的实体正在返回"PersistentCollection“,当我试图得到相关的分布时。
直到昨天,它还在返回"ArrayCollection“。
我不能在PersistentCollection中使用"foreach“,所以我会出错。
不知道我碰了什么做这个..。我要查什么?
发布于 2017-11-08 15:10:49
我认为解决方案是使用Presistent Collection和Collection的方法。例如,您可以通过这样的方式获取Collection元素:
$array = $presistentCollectionObject->getValues();
foreach ($array as $obj) {
dump($obj);
}
注意到,如果直接转储PresistentCollection对象,元素ArrayCollection (包含在其中)将为空。
https://stackoverflow.com/questions/36489012
复制相似问题