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