예제 #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());
 }
예제 #2
0
 public function modelRelationMap()
 {
     return ['country' => array('type' => 'hasOne', 'class' => Country::className(), 'link' => array('countryCode' => 'countryCode'), 'readOnly' => true, 'canDelete' => false, 'allToArray' => true), 'customer' => array('type' => 'belongsTo', 'class' => Customer::className(), 'link' => array('id' => 'customerId'))];
 }