protected $_link = [
'Category' => [
'mapping_type' => self::BELONGS_TO,
'class_name' => 'Category',
'foreign_key' => 'brand',
'mapping_fields' => 'name,id',
'mapping_name' => 'platform_name',
]
];
这个是关联的定义,应为外键有两个,并且都属于同一张表(其实类似字典表),好像tp中的外键只能是一个,有没有办法弄成两个?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
感觉用那个不方便,我直接写这种,要么写原生的
关联模型,一对多么~