Doctrine\ORM\UnitOfWork::isScheduledForInsert PHP Method

isScheduledForInsert() public method

Checks whether an entity is scheduled for insertion.
public isScheduledForInsert ( object $entity ) : boolean
$entity object
return boolean
    public function isScheduledForInsert($entity)
    {
        return isset($this->entityInsertions[spl_object_hash($entity)]);
    }

Usage Example

 /**
  * Check if entity is in a valid state for operations.
  *
  * @param object $entity
  *
  * @return bool
  */
 protected function isValidEntityState($entity)
 {
     $entityState = $this->uow->getEntityState($entity, UnitOfWork::STATE_NEW);
     if ($entityState === UnitOfWork::STATE_NEW) {
         return false;
     }
     // If Entity is scheduled for inclusion, it is not in this collection.
     // We can assure that because it would have return true before on array check
     return !($entityState === UnitOfWork::STATE_MANAGED && $this->uow->isScheduledForInsert($entity));
 }
All Usage Examples Of Doctrine\ORM\UnitOfWork::isScheduledForInsert