Improved and simplified coupon form management

This commit is contained in:
Franck Allimant
2014-05-30 19:58:02 +02:00
parent c738361221
commit d41bbfc9eb
15 changed files with 317 additions and 142 deletions

View File

@@ -327,10 +327,9 @@ class CouponCreateOrUpdateEvent extends ActionEvent
*/
public function setEffects(array $effects)
{
if (null === $effects['amount']) {
throw new InvalidArgumentException('Missing key \'amount\' in Coupon effect ready to be serialized array');
}
$this->amount = $effects['amount'];
// Amount is now optionnal.
$this->amount = isset($effects['amount']) ? $effects['amount'] : 0;
$this->effects = $effects;
}