code/dataobjects/Block.php
/*
	 * Checks if deletion was an actual deletion, not just unpublish
	 * If so, remove relations
	 */
Checks if deletion was an actual deletion, not just unpublish
If so, remove relations
Checks if deletion was an actual deletion not just unpublish If so remove relations
public function onAfterDelete(){
		parent::onAfterDelete();
		if (Versioned::current_stage() == 'Stage') {
			$this->Pages()->removeAll();
			$this->BlockSets()->removeAll();
		}
	}
public function onAfterDelete ( ) { parent :: onAfterDelete ( ) ; if ( Versioned :: current_stage ( ) == 'Stage' ) { $ this -> Pages ( ) -> removeAll ( ) ; $ this -> BlockSets ( ) -> removeAll ( ) ; } }
Checks if deletion was an actual deletion, not just unpublish
 If so, remove relations
Checks if deletion was an actual deletion not just unpublish If so remove relations