d3yii2/yii2-d3acc

View on GitHub
models/base/AcDef.php

Summary

Maintainability
A
55 mins
Test Coverage
<?php
// This class was automatically generated by a giiant build task
// You should not change it manually as it will be overwritten on next build

namespace d3acc\models\base;

use Yii;


/**
 * This is the base-model class for table "ac_def".
 *
 * @property integer $id
 * @property integer $sys_company_id
 * @property string $code
 * @property integer $account_id
 * @property string $table
 * @property string $pk_field
 *
 * @property \d3acc\models\AcRecRef[] $acRecRefs
 * @property \d3acc\models\AcAccount $account
 * @property string $aliasModel
 */
abstract class AcDef extends \yii\db\ActiveRecord
{



    /**
     * @inheritdoc
     */
    public static function tableName(): string
    {
        return 'ac_def';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            'required' => [['account_id'], 'required'],
            'smallint Unsigned' => [['id','sys_company_id','account_id'],'integer' ,'min' => 0 ,'max' => 65535],
            [['code'], 'string', 'max' => 20],
            [['table', 'pk_field'], 'string', 'max' => 100],
            [['account_id'], 'exist', 'skipOnError' => true, 'targetClass' => \d3acc\models\AcAccount::className(), 'targetAttribute' => ['account_id' => 'id']]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('d3acc', 'ID'),
            'sys_company_id' => Yii::t('d3acc', 'Sys Company ID'),
            'code' => Yii::t('d3acc', 'Code'),
            'account_id' => Yii::t('d3acc', 'Account'),
            'table' => Yii::t('d3acc', 'Table'),
            'pk_field' => Yii::t('d3acc', 'Primary key field'),
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeHints(): array
    {
        return array_merge(parent::attributeHints(), [
            'account_id' => Yii::t('d3acc', 'Account'),
            'table' => Yii::t('d3acc', 'Table'),
            'pk_field' => Yii::t('d3acc', 'Primary key field'),
        ]);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAccount()
    {
        return $this->hasOne(\d3acc\models\AcAccount::className(), ['id' => 'account_id'])->inverseOf('acDefs');
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAcRecRefs()
    {
        return $this->hasMany(\d3acc\models\AcRecRef::className(), ['def_id' => 'id'])->inverseOf('def');
    }




}