OrderItem.php 452 Bytes
Newer Older
1 2 3 4 5 6
<?php

namespace yiiunit\data\ar\redis;

class OrderItem extends ActiveRecord
{
7 8 9 10 11
	public static function primaryKey()
	{
		return ['order_id', 'item_id'];
	}

12
	public function attributes()
13 14 15 16
	{
		return ['order_id', 'item_id', 'quantity', 'subtotal'];
	}

17 18
	public function getOrder()
	{
19
		return $this->hasOne(Order::className(), ['id' => 'order_id']);
20 21 22 23
	}

	public function getItem()
	{
24
		return $this->hasOne(Item::className(), ['id' => 'item_id']);
25 26
	}
}