|
|
|
@ -202,7 +202,7 @@ class Customer extends \yii\db\ActiveRecord
|
|
|
|
|
{ |
|
|
|
|
public function getOrders() |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Order', ['customer_id' => 'id']); |
|
|
|
|
return $this->hasMany(Order::className, ['customer_id' => 'id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -210,7 +210,7 @@ class Order extends \yii\db\ActiveRecord
|
|
|
|
|
{ |
|
|
|
|
public function getCustomer() |
|
|
|
|
{ |
|
|
|
|
return $this->hasOne('Customer', ['id' => 'customer_id']); |
|
|
|
|
return $this->hasOne(Customer::className(), ['id' => 'customer_id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
@ -257,7 +257,7 @@ class Customer extends \yii\db\ActiveRecord
|
|
|
|
|
{ |
|
|
|
|
public function getBigOrders($threshold = 100) |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Order', ['customer_id' => 'id']) |
|
|
|
|
return $this->hasMany(Order::className(), ['customer_id' => 'id']) |
|
|
|
|
->where('subtotal > :threshold', [':threshold' => $threshold]) |
|
|
|
|
->orderBy('id'); |
|
|
|
|
} |
|
|
|
@ -291,7 +291,7 @@ class Order extends \yii\db\ActiveRecord
|
|
|
|
|
{ |
|
|
|
|
public function getItems() |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Item', ['id' => 'item_id']) |
|
|
|
|
return $this->hasMany(Item::className(), ['id' => 'item_id']) |
|
|
|
|
->viaTable('tbl_order_item', ['order_id' => 'id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -306,12 +306,12 @@ class Order extends \yii\db\ActiveRecord
|
|
|
|
|
{ |
|
|
|
|
public function getOrderItems() |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('OrderItem', ['order_id' => 'id']); |
|
|
|
|
return $this->hasMany(OrderItem::className(), ['order_id' => 'id']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getItems() |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Item', ['id' => 'item_id']) |
|
|
|
|
return $this->hasMany(Item::className(), ['id' => 'item_id']) |
|
|
|
|
->via('orderItems'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -517,7 +517,7 @@ class Feature extends \yii\db\ActiveRecord
|
|
|
|
|
|
|
|
|
|
public function getProduct() |
|
|
|
|
{ |
|
|
|
|
return $this->hasOne('Product', ['product_id' => 'id']); |
|
|
|
|
return $this->hasOne(Product::className(), ['product_id' => 'id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -527,7 +527,7 @@ class Product extends \yii\db\ActiveRecord
|
|
|
|
|
|
|
|
|
|
public function getFeatures() |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Feature', ['id' => 'product_id']); |
|
|
|
|
return $this->hasMany(Feature::className(), ['id' => 'product_id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
@ -566,7 +566,7 @@ class Feature extends \yii\db\ActiveRecord
|
|
|
|
|
|
|
|
|
|
public function getProduct() |
|
|
|
|
{ |
|
|
|
|
return $this->hasOne('Product', ['product_id' => 'id']); |
|
|
|
|
return $this->hasOne(Product::className(), ['product_id' => 'id']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function scenarios() |
|
|
|
@ -586,7 +586,7 @@ class Product extends \yii\db\ActiveRecord
|
|
|
|
|
|
|
|
|
|
public function getFeatures() |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Feature', ['id' => 'product_id']); |
|
|
|
|
return $this->hasMany(Feature::className(), ['id' => 'product_id']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function scenarios() |
|
|
|
|