src/Component/BaseComponent.php
protected function saveEntity($entity)
    {
        try {
            $this->entityManager->persist($entity);
            $this->entityManager->flush($entity);
            return $entity;
        } catch (OptimisticLockException $e) {
            throw new DatabaseException($e->getMessage());
        }
    }
protected function saveEntity($entity)
    {
        try {
            $this->entityManager->persist($entity);
            $this->entityManager->flush($entity);
            return $entity;
        } catch (OptimisticLockException $e) {
            throw new DatabaseException($e->getMessage());
        }
    }
protected function saveEntity ( $ entity ) { try { $ this -> entityManager -> persist ( $ entity ) ; $ this -> entityManager -> flush ( $ entity ) ; return $ entity ; } catch ( OptimisticLockException $ e ) { throw new DatabaseException ( $ e -> getMessage ( ) ) ; } }
Insert or update entity
@param  object $entity
@return object
@throws DatabaseException
Insert or update entity