87 lines
2.0 KiB
PHP
87 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
/**
|
|
* This is the model class for table "event_registration".
|
|
*
|
|
* @property integer $id
|
|
* @property integer $id_event
|
|
* @property integer $id_customer
|
|
* @property integer $id_card
|
|
* @property integer $id_ticket
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property string $canceled_at
|
|
* @property string $deleted_at
|
|
*/
|
|
class EventRegistration extends \yii\db\ActiveRecord
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'event_registration';
|
|
}
|
|
|
|
/**
|
|
* @inheritdocd
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['id_event', 'id_customer'], 'integer'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => Yii::t('event-registration', 'ID'),
|
|
'id_event' => Yii::t('event-registration', 'Id Event'),
|
|
'id_customer' => Yii::t('event-registration', 'Id Customer'),
|
|
'created_at' => Yii::t('event-registration', 'Created At'),
|
|
'updated_at' => Yii::t('event-registration', 'Updated At'),
|
|
'canceled_at' => Yii::t('event-registration', 'Canceled At'),
|
|
'deleted_at' => Yii::t('event-registration', 'Deleted At'),
|
|
];
|
|
}
|
|
|
|
public function behaviors()
|
|
{
|
|
return ArrayHelper::merge( [
|
|
[
|
|
'class' => TimestampBehavior::className(),
|
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
|
]
|
|
],
|
|
parent::behaviors());
|
|
}
|
|
|
|
|
|
public function getEvent(){
|
|
return $this->hasOne($this->getEventClass(),['id' => 'id_event']);
|
|
}
|
|
|
|
public function getCustomer(){
|
|
return $this->hasOne($this->getCustomerClass(),['id' => 'id_customer']);
|
|
}
|
|
|
|
|
|
public function getEventClass(){
|
|
return Event::class;
|
|
}
|
|
|
|
public function getCustomerClass(){
|
|
return Customer::class;
|
|
}
|
|
}
|