How to find out if block is deleted

Permalink
Somehow this is not obvious to me but if I create a block like so:

$block = Block::getByID(7);


How can I actually find out from the $block-object whether this block has been deleted and is therefore currently not used on any page? There is no "isDeleted" check or anything like that....

nerdess
 
nerdess replied on at Permalink Reply
nerdess
I tried $block->getCollectionList(); and thought that would do the trick but it gives me the pages a block is on regardless (!) whether the block has been deleted or not. For a deleted block I expected an empty array in return!

I think $block->getCollectionList() is therefore wrong as it should only return a page IF the block is actually visible on the page and has not been deleted.
nerdess replied on at Permalink Reply
nerdess
Ok so......found out there is no way as blocks are tied to pages. I'd need to iterate over all pages and check if the block is on any of them.

Grrrrrr.