function remove($index) { $subject = $this[$index]; $subject->setParent(null); parent::remove($index); }