Php ComputeChangeSet():是否应返回所属方集合更改?
请遵循以下示例:Php ComputeChangeSet():是否应返回所属方集合更改?,php,doctrine-orm,Php,Doctrine Orm,请遵循以下示例: /** * @ORM\Table(...) * @ORM\Entity(...) */ class Foo { /** * @ORM\OneToMany(targetEntity="Bar", mappedBy="foo") */ protected $bars; //setters and getters omitted } 在教义2中,应该 $cs = $this->computeChangeSet(
/**
* @ORM\Table(...)
* @ORM\Entity(...)
*/
class Foo
{
/**
* @ORM\OneToMany(targetEntity="Bar", mappedBy="foo")
*/
protected $bars;
//setters and getters omitted
}
在教义2中,应该
$cs = $this->computeChangeSet(
$em->getClassMetadata(get_class($foo)),
$foo
);
如果更改了$bar
,返回['bar']
我这样问是因为,据我所知,doctrine2只考虑拥有方的变化好问题。也许它仍然在一个变更集中注册变更,但当持久化时,它意识到这些变更不需要被持久化?@Wilt测试它,返回关于拥有方的任何信息。这迫使我在用新的表单值绑定对象之前存储“previous”集合。我当然知道doctrine2 preUpdate()事件