30 lines
821 B
PHP
30 lines
821 B
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class ProductOrderItems extends \common\modelsgii\ProductOrderItems
|
|
{
|
|
const EVENT_CREATED = 'orderCreated';
|
|
const EVENT_PAYED = 'orderPayed';
|
|
const EVENT_CANCELED = 'orderCanceled';
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
'value' => new \yii\db\Expression('NOW()'),
|
|
],
|
|
];
|
|
}
|
|
|
|
public function getDrug(){
|
|
return $this->hasOne(Drug::class,['id' => 'drug_id']);
|
|
}
|
|
} |