public function findById($id, $draft = true)
    {
        if ($draft) {
            $this->setDraftVersionFilter(! $draft);
        }

        $blocks = $this->getRepository()->findById($id);

        if ($draft) {
            foreach ($blocks as $block) {
                if (null !== $revision = $this->revisionManager->getDraftRevision($block)) {
                    $this->revisionManager->revert($block, $revision);
                }
            }
        }

        return $blocks;
    }
public function findById($id, $draft = true)
    {
        if ($draft) {
            $this->setDraftVersionFilter(! $draft);
        }

        $blocks = $this->getRepository()->findById($id);

        if ($draft) {
            foreach ($blocks as $block) {
                if (null !== $revision = $this->revisionManager->getDraftRevision($block)) {
                    $this->revisionManager->revert($block, $revision);
                }
            }
        }

        return $blocks;
    }
public function findById ( $ id , $ draft = true ) { if ( $ draft ) { $ this -> setDraftVersionFilter ( ! $ draft ) ; } $ blocks = $ this -> getRepository ( ) -> findById ( $ id ) ; if ( $ draft ) { foreach ( $ blocks as $ block ) { if ( null !== $ revision = $ this -> revisionManager -> getDraftRevision ( $ block ) ) { $ this -> revisionManager -> revert ( $ block , $ revision ) ; } } } return $ blocks ; }
Find a Block in the repository in optional draft

@param integer  $id
@param bool     $draft

@return BlockInterface
Find a Block in the repository in optional draft