0
在ZF2中开始使用原则并需要从持久化中删除一个实体。ZF2 - 原则 - 删除一个持久化的实体
$result = $em->getRepository('zmpim\Entity\Collection')->findOneBy(array('id'=>$id));
$products = $result->getProducts();
$this->assertSame(1, count($products));
$this->assertSame(3, count($products[0]->getFields()));
$em->remove($result);
$em->persist($result);
$em->flush($result);
该示例在单元测试中。我希望,该实体在它之后被删除。但是实体和一些OneToMany实体仍然存在。
铜n00n
尝试,并且很好地测试映射,但它不会失败。这似乎是正确的。它不删除产品集合是其成员的实体... – n00n
很酷。发现失败....其他。 – n00n