public function preUpdate(Enlight_Event_EventArgs
$arguments) { /** @var Detail $orderDetail */
$orderDetail =
$arguments->
get('entity'
);
$entityManager =
$arguments->
get('entityManager'
);
// returns a change set for the model, which contains all changed properties with the old and new value.
$changeSet =
$entityManager->
getUnitOfWork()->
getEntityChangeSet($orderDetail);
$this->stockService->
updateProductDetail( $orderDetail,
isset($changeSet['articleNumber'
]) ?
$changeSet['articleNumber'
][0
] : null,
isset($changeSet['quantity'
]) ?
$changeSet['quantity'
][0
] : null,
isset($changeSet['articleNumber'
]) ?
$changeSet['articleNumber'
][1
] : null,
isset($changeSet['quantity'
]) ?
$changeSet['quantity'
][1
] : null
);
} /**
* If an position is added, the stock of the product will be reduced by the ordered quantity.
*/