Cannot delete thread, complains about foreign key constraints

If I don't add the orphanRemoval part then I try to do

$threadManager->deleteThread($thread);

I get this exception

An exception occurred while executing 'DELETE FROM milia_pb_thread WHERE id = ?' with params [7]:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`srb3`.`milia_pb_message`, CONSTRAINT `FK_BC0833E1E2904019` FOREIGN KEY (`thread_id`) REFERENCES `milia_pb_thread` (`id`))