public function clearVersions($entity) {
        $entity = $entity->getHead();
        $versions = $entity->getVersions();

        foreach($versions as $version) {
            $this->delete($version, false);
        }
        $versions->clear();
        $this->persist($entity, 'overwrite');

        return $entity;
    }
public function clearVersions($entity) {
        $entity = $entity->getHead();
        $versions = $entity->getVersions();

        foreach($versions as $version) {
            $this->delete($version, false);
        }
        $versions->clear();
        $this->persist($entity, 'overwrite');

        return $entity;
    }
public function clearVersions ( $ entity ) { $ entity = $ entity -> getHead ( ) ; $ versions = $ entity -> getVersions ( ) ; foreach ( $ versions as $ version ) { $ this -> delete ( $ version , false ) ; } $ versions -> clear ( ) ; $ this -> persist ( $ entity , 'overwrite' ) ; return $ entity ; }
Clears old versions of an entity.

@param object $entity
@return object
Clears old versions of an entity .