我如何使用 cakephp3 中的关系创建 CRUD

How i create CRUD with relationships in cakephp3

我如何处理用户和服务订单之间的关系?使用代码,我无法在团队中添加用户以获取服务订单。 cakebake时,创建了控制器TeamHasUsersController,但是添加的表单没有任何字段。

蛋糕烘烤时产生了污垢。

在service_orders中:把requester_users_id改成user_id,字段前面的图标会变成红色的键(外键)。 Cake 约定需要一个外键命名为 [model]_id.

table 的名称与关联应为 "team_users"。

Three database tables are required for a BelongsToMany association. In the example above we would need tables for articles, tags and articles_tags. The articles_tags table contains the data that links tags and articles together. The joining table is named after the two tables involved, separated with an underscore by convention. In its simplest form, this table consists of article_id and tag_id.

habtm relationship