代码拉取完成,页面将自动刷新
集成模型类需要继承`\common\components\ActiveRecord`类
主键默认为`id`,如果主键不是`id`,需要通过`@Property(isPrimaryKey: true)`注解指定主键
严格模式需要在模型类中定义字段,非严格模式兼容了yii的rules,rules中的字段必须与会作为私有属性输出
字段默认为`id`,如果字段不是`id`,需要通过`@Property`注解指定字段
$user = DdUser::findRecord(['mobile'=> $mobile])->asArray();
$user = DdUser::findRecord(['mobile'=> $mobile])->toArray();
<?php
namespace addons\diandi_hotel\models\Rpc;
use EasySwoole\FastDb\Attributes\Property;
class ceshiRpcModel extends \common\components\ActiveRecord
{
#[Property(isPrimaryKey: true)]
public int $id;
#[Property]
public ?int $store_id;
#[Property]
public ?int $bloc_id;
/**
* {@inheritdoc}
*/
public static function tableName(): string
{
return '{{%diandi_switch_ceshi}}';
}
/**
* {@inheritdoc}
*/
public function rules(): array
{
return [
[[
'bloc_id',
'store_id',
], 'integer'],
[['create_time', 'update_time'], 'safe']
];
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。