OrderItem.php 587 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?php

namespace yiiunit\data\ar\elasticsearch;

/**
 * Class OrderItem
 *
 * @property integer $order_id
 * @property integer $item_id
 * @property integer $quantity
 * @property string $subtotal
 */
class OrderItem extends ActiveRecord
{
15
	public function attributes()
16
	{
17
		return ['order_id', 'item_id', 'quantity', 'subtotal'];
18 19 20 21
	}

	public function getOrder()
	{
22
		return $this->hasOne(Order::className(), [ActiveRecord::PRIMARY_KEY_NAME => 'order_id']);
23 24 25 26
	}

	public function getItem()
	{
27
		return $this->hasOne(Item::className(), [ActiveRecord::PRIMARY_KEY_NAME => 'item_id']);
28 29
	}
}