/**
  * GetUnitOfWork
  *
  * @param ArrayCollection $collection         Collection
  * @param bool            $clearEntityManager ClearEntityManager
  *
  * @return CrudUnitOfWork
  */
 public function getUnitOfWork(ArrayCollection $collection, $clearEntityManager = false)
 {
     if ($clearEntityManager) {
         $this->crudManager->clearEntityManager();
     }
     return $this->crudManager->filterCollection($collection, false);
 }
 /**
  * Test create and not flush entity
  *
  * @return void
  */
 public function testCreateAndNotFlushEntity()
 {
     $entity = $this->prepareEntity();
     $this->entityManager->expects($this->once())->method('persist')->with($entity)->will($this->returnValue(null));
     $this->entityManager->expects($this->never())->method('flush')->with($entity)->will($this->returnValue(null));
     $this->crudManager->create($entity, false);
 }