public function onBeforeDelete()
    {
        parent::onBeforeDelete();
        
        // Delete all locations attached to this order
        foreach ($this->Locations() as $item) {
            $item->delete();
        }

        // Delete all notes attached to this order
        foreach ($this->Notes() as $item) {
            $item->delete();
        }
    }
public function onBeforeDelete()
    {
        parent::onBeforeDelete();
        
        // Delete all locations attached to this order
        foreach ($this->Locations() as $item) {
            $item->delete();
        }

        // Delete all notes attached to this order
        foreach ($this->Notes() as $item) {
            $item->delete();
        }
    }
public function onBeforeDelete ( ) { parent :: onBeforeDelete ( ) ; // Delete all locations attached to this order foreach ( $ this -> Locations ( ) as $ item ) { $ item -> delete ( ) ; } // Delete all notes attached to this order foreach ( $ this -> Notes ( ) as $ item ) { $ item -> delete ( ) ; } }
Cleanup DB on removal
Cleanup DB on removal