src/Model/Page.php
public function resetLayoutBlock($publishedBlocks)
    {

	    $blocksToRemove = $this->layoutBlock->filter(function(LayoutBlock $originalBlock) use($publishedBlocks){
			$toRemove = true;
	    	foreach ($publishedBlocks as $block){
	    		if(!$block->getId()){
				    $toRemove = false;
			    }

				if($block->getId() == $originalBlock->getId()){
					$toRemove = false;
				}
			}

			return $toRemove;
	    });

        foreach ($blocksToRemove as $block) {
				$block->setNoAutoDraft(true);
				$this->layoutBlock->removeElement($block);
        }

    }
public function resetLayoutBlock($publishedBlocks)
    {

	    $blocksToRemove = $this->layoutBlock->filter(function(LayoutBlock $originalBlock) use($publishedBlocks){
			$toRemove = true;
	    	foreach ($publishedBlocks as $block){
	    		if(!$block->getId()){
				    $toRemove = false;
			    }

				if($block->getId() == $originalBlock->getId()){
					$toRemove = false;
				}
			}

			return $toRemove;
	    });

        foreach ($blocksToRemove as $block) {
				$block->setNoAutoDraft(true);
				$this->layoutBlock->removeElement($block);
        }

    }
public function resetLayoutBlock ( $ publishedBlocks ) { $ blocksToRemove = $ this -> layoutBlock -> filter ( function ( LayoutBlock $ originalBlock ) use ( $ publishedBlocks ) { $ toRemove = true ; foreach ( $ publishedBlocks as $ block ) { if ( ! $ block -> getId ( ) ) { $ toRemove = false ; } if ( $ block -> getId ( ) == $ originalBlock -> getId ( ) ) { $ toRemove = false ; } } return $ toRemove ; } ) ; foreach ( $ blocksToRemove as $ block ) { $ block -> setNoAutoDraft ( true ) ; $ this -> layoutBlock -> removeElement ( $ block ) ; } }
Remove all layout blocks and replace with those in the
serialized page snapshot.

@param ArrayCollection $publishedBlocks
Remove all layout blocks and replace with those in the serialized page snapshot .