Checks whether an entity is registered as removed/deleted with the unit
of work.
public isScheduledForDelete ( object $entity ) : boolean | ||
$entity | object | |
Результат | boolean |
/** * @param B2bCustomer $b2bCustomer */ protected function scheduleUpdate(B2bCustomer $b2bCustomer) { if ($this->uow->isScheduledForDelete($b2bCustomer)) { return; } $this->queued[$b2bCustomer->getId()] = $b2bCustomer; }
/** * @param string $customerIdentity * @param Account $account * @param Channel $channel */ protected function scheduleUpdate($customerIdentity, Account $account = null, Channel $channel = null) { if ($account && $channel) { // skip removal, history items will be flushed by FK constraints if ($this->uow->isScheduledForDelete($account) || $this->uow->isScheduledForDelete($channel)) { return; } $key = sprintf('%s__%s', spl_object_hash($account), spl_object_hash($channel)); $this->queued[$customerIdentity][$key] = ['account' => $account->getId() ?: $account, 'channel' => $channel->getId() ?: $channel]; } }
/** * Determines whether an entity instance is managed in this EntityManager. * * @param object $entity * * @return boolean TRUE if this EntityManager currently manages the given entity, FALSE otherwise. */ public function contains($entity) { return $this->unitOfWork->isScheduledForInsert($entity) || $this->unitOfWork->isInIdentityMap($entity) && !$this->unitOfWork->isScheduledForDelete($entity); }