本文整理汇总了PHP中Doctrine\ORM\UnitOfWork::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP UnitOfWork::remove方法的具体用法?PHP UnitOfWork::remove怎么用?PHP UnitOfWork::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\UnitOfWork
的用法示例。
在下文中一共展示了UnitOfWork::remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* Removes an entity instance.
*
* A removed entity will be removed from the database at or before transaction commit
* or as a result of the flush operation.
*
* @param object $entity The entity instance to remove.
*/
public function remove($entity)
{
if (!is_object($entity)) {
throw ORMInvalidArgumentException::invalidObject('EntityManager#remove()', $entity);
}
$this->errorIfClosed();
$this->unitOfWork->remove($entity);
}
示例2: remove
/**
* Removes an entity instance.
*
* A removed entity will be removed from the database at or before transaction commit
* or as a result of the flush operation.
*
* @param object $entity The entity instance to remove.
*/
public function remove($entity)
{
if (!is_object($entity)) {
throw new \InvalidArgumentException(gettype($entity));
}
$this->errorIfClosed();
$this->unitOfWork->remove($entity);
}
示例3: postSoftDelete
/**
* TODO: set deletedAt field through reflection and loading softdeletable config
*
* @param LifecycleEventArgs $eventArgs
*/
public function postSoftDelete(LifecycleEventArgs $eventArgs)
{
if (!$this->active) {
return;
}
$entity = $eventArgs->getEntity();
$this->em = $eventArgs->getEntityManager();
$this->uow = $this->em->getUnitOfWork();
// this will ensure our handling in onFlush scheduled deletes will execute
$this->uow->remove($entity);
}