fitness-web/common/models/DoorLog.php

97 lines
2.3 KiB
PHP

<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "door_log".
*
* @property integer $id_door_log
* @property integer $id_card
* @property integer $id_customer
* @property integer $id_key
* @property integer $direction
* @property integer $type
* @property string $created_at
*/
class DoorLog extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'door_log';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_card', 'id_customer', 'id_key', 'direction', 'type'], 'integer'],
[['created_at'], 'required'],
[['created_at'], 'safe']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_door_log' => Yii::t('common/door_log', 'Id Door Log'),
'id_card' => Yii::t('common/door_log', 'Bérlet kártya'),
'id_customer' => Yii::t('common/door_log', 'Vendég'),
'id_key' => Yii::t('common/door_log', 'Kulcs'),
'direction' => Yii::t('common/door_log', 'Irány'),
'type' => Yii::t('common/door_log', 'Típus'),
'created_at' => Yii::t('common/door_log', 'Időpont'),
];
}
public function getCustomer(){
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
}
public function getCustomerName(){
$result = "";
if (isset($this->customer)){
$result = $this->customer->name;
}
return $result;
}
public function getCard(){
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
}
public function getCardNumber(){
$result = "";
if (isset($this->card)){
$result = $this->card->number;
}
return $result;
}
public function getKey(){
return $this->hasOne( Key::className(), ["id_key" =>"id_key" ] );
}
public function getKeyNumber(){
$result = "";
if (isset($this->key)){
$result = $this->key->number;
}
return $result;
}
public function getDirectionName(){
$result = "";
if (isset($this->direction)){
$result = $this->direction;
}
return $result;
}
}