protected function onBeforeDelete()
    {
        foreach ($this->Items() as $item) {
            $item->delete();
        }

        foreach ($this->Modifiers() as $modifier) {
            $modifier->delete();
        }

        foreach ($this->OrderStatusLogs() as $logEntry) {
            $logEntry->delete();
        }

        // just remove the payment relations…
        // that way payment objects still persist (they might be relevant for book-keeping?)
        $this->Payments()->removeAll();

        parent::onBeforeDelete();
    }
protected function onBeforeDelete()
    {
        foreach ($this->Items() as $item) {
            $item->delete();
        }

        foreach ($this->Modifiers() as $modifier) {
            $modifier->delete();
        }

        foreach ($this->OrderStatusLogs() as $logEntry) {
            $logEntry->delete();
        }

        // just remove the payment relations…
        // that way payment objects still persist (they might be relevant for book-keeping?)
        $this->Payments()->removeAll();

        parent::onBeforeDelete();
    }
protected function onBeforeDelete ( ) { foreach ( $ this -> Items ( ) as $ item ) { $ item -> delete ( ) ; } foreach ( $ this -> Modifiers ( ) as $ modifier ) { $ modifier -> delete ( ) ; } foreach ( $ this -> OrderStatusLogs ( ) as $ logEntry ) { $ logEntry -> delete ( ) ; } // just remove the payment relations… // that way payment objects still persist (they might be relevant for book-keeping?) $ this -> Payments ( ) -> removeAll ( ) ; parent :: onBeforeDelete ( ) ; }
delete attributes, statuslogs, and payments
delete attributes statuslogs and payments