예제 #1
0
 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)]);
 }
예제 #2
0
파일: User.php 프로젝트: harp-orm/harp
 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');
 }
예제 #3
0
 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')]);
 }
예제 #4
0
 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)]);
 }
예제 #5
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)]);
 }
예제 #6
0
 public static function initialize(Config $config)
 {
     SoftDeleteTrait::initialize($config);
     FreezableValueTrait::initialize($config);
 }