protected function unpublishOthers($entity) {
        if(!$entity->isHead()) {
            $head = $entity->getHead();
            if($head->isPublished()) {
                $head->unpublish();
                $this->persist($head, false);
            }
        }

        foreach($entity->getVersions() as $version) {
            if($version !== $entity && $version->isPublished()) {
                $version->unpublish();
                $this->persist($version, false);
            }
        }
    }
protected function unpublishOthers($entity) {
        if(!$entity->isHead()) {
            $head = $entity->getHead();
            if($head->isPublished()) {
                $head->unpublish();
                $this->persist($head, false);
            }
        }

        foreach($entity->getVersions() as $version) {
            if($version !== $entity && $version->isPublished()) {
                $version->unpublish();
                $this->persist($version, false);
            }
        }
    }
protected function unpublishOthers ( $ entity ) { if ( ! $ entity -> isHead ( ) ) { $ head = $ entity -> getHead ( ) ; if ( $ head -> isPublished ( ) ) { $ head -> unpublish ( ) ; $ this -> persist ( $ head , false ) ; } } foreach ( $ entity -> getVersions ( ) as $ version ) { if ( $ version !== $ entity && $ version -> isPublished ( ) ) { $ version -> unpublish ( ) ; $ this -> persist ( $ version , false ) ; } } }
Ensures that only one entity can be published at a time.

@param object $entity
@return void
Ensures that only one entity can be published at a time .