它有一个实体和2个事件监听器,当字段更新时,检查器检查该字段是否已更改,然后处理逻辑。问题是侦听器阻塞了第二个侦听器,因此更改检查器在第二个侦听器中不起作用(它说该字段没有更改),尽管基础中有更改。
public function postUpdate(LifecycleEventArgs $eventArgs): void
{
$entity = $eventArgs->getObject();
if ($entity instance of Group) {
$changedFields = $eventArgs->getEntityManager()->getUnitOfWork()->getEntityChangeSet($entity);
$isChanged = $this->checker->isChanged($changedFields, ['teacher']);
if ($isChanged) {
$this->proceedTeacherChanges($entity);
}