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

namespace yiiunit\data\ar\redis;

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

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

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

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