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) { SoftDeleteTrait::initialize($config); $config->belongsTo('address', __NAMESPACE__ . '\\Address')->belongsToPolymorphic('location', __NAMESPACE__ . '\\City')->hasMany('posts', __NAMESPACE__ . '\\Post', ['inverseOf' => 'user', 'linkClass' => __NAMESPACE__ . '\\LinkManyPosts'])->hasOne('profile', __NAMESPACE__ . '\\Profile', ['inverseOf' => 'user'])->assertPresent('name')->serializeNative('object'); }
public static function initialize(Config $config) { SoftDeleteTrait::initialize($config); $config->addRels([new Rel\BelongsTo('city', $config, City::getRepo()), new Rel\BelongsTo('country', $config, Country::getRepo()), new Rel\HasOne('purchase', $config, Purchase::getRepo(), ['foreignKey' => 'billingId'])])->addAsserts([new Assert\Present('firstName'), new Assert\Present('lastName'), new Assert\Present('email'), new Assert\Present('phone'), new Assert\Present('postCode'), new Assert\Present('line1'), new Assert\Email('email')]); }
public static function initialize(Config $config) { SoftDeleteTrait::initialize($config); FreezableValueTrait::initialize($config); $config->addAsserts([new Assert\Present('quantity'), new Assert\Number('quantity'), new Assert\GreaterThan('quantity', 0)]); }
public static function initialize(Config $config) { SoftDeleteTrait::initialize($config); $config->addRels([new Rel\HasMany('products', $config, Product::getRepo(), ['inverseOf' => 'store']), new Rel\HasMany('storePurchases', $config, StorePurchase::getRepo(), ['inverseOf' => 'store'])])->addAsserts([new Assert\Present('name'), new Assert\LengthLessThan('name', 150)]); }
public static function initialize(Config $config) { SoftDeleteTrait::initialize($config); FreezableValueTrait::initialize($config); }