public static function initialize(Config $config) { TransferTrait::initialize($config); ItemGroupTrait::initialize($config); CurrencyTrait::initialize($config); $config->setTable('Basket')->addRels([new Rel\HasMany('items', $config, ProductItem::getRepo(), ['inverseOf' => 'basket'])]); }
public static function initialize(Config $config) { ValueTrait::initialize($config); TransferTrait::initialize($config); TimestampsTrait::initialize($config); $config->addRels([new Rel\BelongsTo('storePurchase', $config, StorePurchase::getRepo())])->addAsserts([new Assert\GreaterThan('value', 0), new Assert\Callback('value', function ($refund) { return $refund->getValue()->lessThanOrEqual($refund->getStorePurchase()->getRemainingValue()); }, ':name is more than the remaining value')]); }
public static function initialize(Config $config) { TransferTrait::initialize($config); ItemGroupTrait::initialize($config); TimestampsTrait::initialize($config); RandomKeyTrait::initialize($config); CurrencyTrait::initialize($config); $config->setTable('Purchase')->addRels([new Rel\HasMany('items', $config, PurchaseItem::getRepo(), ['inverseOf' => 'purchase']), new Rel\HasMany('storePurchases', $config, StorePurchase::getRepo(), ['inverseOf' => 'purchase']), new Rel\BelongsTo('billing', $config, Address::getRepo())]); }