Exemple #1
0
 function checkBaseCounts($type = '', $clientCode = '', $customers = 0, $addresses = 0, $phones = 0, $orders = 0, $items = 0, $attributes = 0, $countries = 2, $products = 4)
 {
     if ($type != '') {
         switch ($type) {
             case 'full':
                 $customers = 1;
                 $addresses = 1;
                 $phones = 1;
                 $orders = 1;
                 $items = 3;
                 $attributes = $clientCode == 'CLIENT2' ? 5 : 4;
                 break;
             case 'lessoneitem':
                 $customers = 1;
                 $addresses = 1;
                 $phones = 1;
                 $orders = 1;
                 $items = 2;
                 $attributes = $clientCode == 'CLIENT2' ? 5 : 4;
                 break;
             case 'lessaddress':
                 $customers = 1;
                 $addresses = 0;
                 $phones = 1;
                 $orders = 1;
                 $items = 3;
                 $attributes = $clientCode == 'CLIENT2' ? 5 : 4;
                 break;
         }
     }
     $this->assertEquals($customers, Customer::find()->count());
     $this->assertEquals($addresses, Address::find()->count());
     $this->assertEquals($attributes, AttributeValues::find()->count());
     $this->assertEquals($orders, Order::find()->count());
     $this->assertEquals($items, Item::find()->count());
     $this->assertEquals($countries, Country::find()->count());
     $this->assertEquals($products, Product::find()->count());
 }
Exemple #2
0
 public function modelRelationMap()
 {
     return ['product' => array('type' => 'hasOne', 'class' => Product::className(), 'link' => array('productCode' => 'productCode'), 'allToArray' => true), 'order' => array('type' => 'belongsTo', 'class' => Order::className(), 'link' => array('id' => 'orderId')), 'customer' => array('type' => 'belongsTo', 'class' => Customer::className(), 'link' => array('id' => 'customerId'))];
 }
Exemple #3
0
 public function modelRelationMap()
 {
     return ['customerAttributes' => array('type' => 'hasEav', 'class' => CustomerAttributes::className(), 'link' => array('objectId' => 'id'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_FROM_PARENT_MAINT, 'allToArray' => true, 'activeAttributesInParent' => true), 'address' => array('type' => 'hasOne', 'class' => Address::className(), 'link' => array('id' => 'addressId'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_BI_DIRECT_MAINT_FROM_PARENT, 'autoLink' => array('fromParent' => array('customerId' => 'id'), 'fromChild' => array('id' => 'addressId')), 'allToArray' => true), 'phone' => array('type' => 'hasOne', 'class' => Phone::className(), 'link' => array('id' => 'phoneId'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_BI_DIRECT_MAINT_FROM_PARENT, 'autoLink' => array('fromParent' => array('customerId' => 'id'), 'fromChild' => array('id' => 'phoneId')), 'allToArray' => true), 'orders' => array('type' => 'hasMany', 'class' => Order::className(), 'link' => array('customerId' => 'id'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_FROM_PARENT_MAINT, 'allToArray' => true)];
 }