【发布时间】:2016-03-15 22:50:59
【问题描述】:
当我在 Cakephp 3 中创建我的模型时遇到了一个小问题,我必须将表(pistolets 和 cuves)与“hasOne 关联”相关联,问题是当我使用 ./cake bake 创建我的 Cuves 模型时,我得到一个实体叫 Cufe,我不知道这个名字是从哪里来的,而且当我打电话给$pistolets = $this->Pistolets->find('all')->contain('Cuves'); 时,我也得到一个看起来像这样的对象:
[id] => 1
[libelle] => P1
[volumetrique_id] => 1
[cuve_id] => 1
[pompiste_id] => EE324925
[date_affectation] => Cake\I18n\FrozenTime Object
(
[date] => 2016-03-10 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
[cufe] => Cake\ORM\Entity Object
(
[_properties:protected] => Array
(
[id] => 1
[libelle] => C1
[capacite] => 2000
[carburant_id] => 1
)
我检查了我写的每一段代码,我可以在其中找到Cufes这个词,谁能解释一下 cakephp 3 是如何生成代码的?这可能是一个错误还是只是我的错误?
【问题讨论】:
标签: php entity cakephp-3.0