public static function initialize(Config $config) { CurrencyTrait::initialize($config); ValueTrait::initialize($config); SoftDeleteTrait::initialize($config); $config->addRels([new Rel\BelongsTo('store', $config, Store::getRepo()), new Rel\HasMany('productItems', $config, ProductItem::getRepo(), ['foreignKey' => 'refId'])])->addAsserts([new Assert\Present('name'), new Assert\LengthLessThan('name', 150)]); }
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) { CurrencyTrait::initialize($config); ValueTrait::initialize($config); }
public static function initialize(Config $config) { ValueTrait::initialize($config); }