cakephp 3.x保存深度关联

cakephp 3.x保存深度关联,cakephp,cakephp-3.0,Cakephp,Cakephp 3.0,以下模型与cakephp 3中的常规表格: 图书-归属->出版商组号 他认为: echo $this->Form->input('isbn'); echo $this->Form->input('name'); echo $this->Form->input('writer'); echo $this->Form->input('price', ['type' => 'number']); echo $this->Form->in

以下模型与cakephp 3中的常规表格:

图书-归属->出版商组号

他认为:

echo $this->Form->input('isbn');
echo $this->Form->input('name');
echo $this->Form->input('writer');
echo $this->Form->input('price', ['type' => 'number']);
echo $this->Form->input('publisher_id', ['options' => $publishers]);
echo $this->Form->input('publisher.groupnumbers.0.number');
控制器:

$associations = ['associated' =>[
        'Publishers',
        'Publishers.Groupnumbers'
    ]
];
if ($this->request->is('post')) {
    $book = $this->Books->patchEntity($book, $this->request->data, $associations);
    if ($this->Books->save($book)){
        //do something
    } else {
        //do somethin else
         debug ($book->errors());
    }
}
此保存方法返回false,错误为

'publisher'=>['name'=>['\u必需'=>'此字段为空 必需']]

为什么要向cakephp询问发布者的名称?我没有在这里创建新的发布者,发布者id正在链接到现有的发布者。如果我不想保存组号,它就可以完美地工作。 这个代码怎么了

编辑: 我试过了


但是这不会改变任何事情。

$this->Form->input'publisher.g如果一个现有的发布者中还没有groupnumber,我会尝试添加它。
$data['publisher']['id'] = $this->request->data['publisher_id'];
// and $data['publisher.id'] = $this->request->data['publisher_id'];
unset($data['publisher_id']);
$book = $this->Books->patchEntity($book, $data, $associations);