Manager/BaseManager.php
public function persist($object, $flush = true)
    {
        if ($object->getId()) {
            $this->update($object, $flush);
        } else {
            $this->create($object, $flush);
        }
    }
public function persist($object, $flush = true)
    {
        if ($object->getId()) {
            $this->update($object, $flush);
        } else {
            $this->create($object, $flush);
        }
    }
public function persist ( $ object , $ flush = true ) { if ( $ object -> getId ( ) ) { $ this -> update ( $ object , $ flush ) ; } else { $ this -> create ( $ object , $ flush ) ; } }
Persist an object into database.

@param Object $object Object
@param bool   $flush  Flush entity manager
Persist an object into database .