src/Repository/Doctrine/Repository.php
public function persist($entity, $flush = true) {
        $this->entities->persist($entity);
        if($flush) {
            $this->entities->flush();
        }
    }
public function persist($entity, $flush = true) {
        $this->entities->persist($entity);
        if($flush) {
            $this->entities->flush();
        }
    }
Persists an entity.

@param object  $entity
@param boolean $flush
@return void