mvdnbrk/warehouse-framework

Handle the OrderLine updating event.

Closed this issue · 0 comments

The OrderLineObserver currently prevents updating an OrderLine as follows:

public function updating(OrderLine $line)
{
    if ($line->gtin !== $line->getOriginal('gtin')) {
        throw new LogicException('The GTIN attribute can not be changed.');
    }

    if ($line->order_id !== $line->getOriginal('order_id')) {
        throw new LogicException('The order ID attribute can not be changed.');
    }
}

We might prevent updating an OrderLine here just by returning false or a more generic LogicException with a message saying: "An order line can not be updated".