CakePHP3系|フォームを作る際にエンティティーをセットする

エンティティーが一つの場合

第一引数にエンティティーを渡す

echo $this->Form->create($entity, [
    'type' => 'post',
    'url'  => '/index.html',
]);

エンティティを複数渡す場合

エンティティーは、第一引数に配列にして渡す

echo $this->Form->create(
    [
        'Articles => $articlesEntity,
        'Users'   => $usersEntity,
    ],
    [
        'type' => 'post',
        'url'  => '/index.html',
    ]
);

------------------------------
作成日:2018年03月20日
更新日:2018年03月20日
------------------------------

ページの先頭へ