OrderItem.php 488 Bytes
Newer Older
1 2 3 4
<?php

namespace yiiunit\data\ar\redis;

5
use yii\redis\RecordSchema;
6 7 8

class OrderItem extends ActiveRecord
{
9 10 11 12 13 14 15 16 17 18
	public static function primaryKey()
	{
		return ['order_id', 'item_id'];
	}

	public static function attributes()
	{
		return ['order_id', 'item_id', 'quantity', 'subtotal'];
	}

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

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