cakephp-3.0 - 在 Cakephp 4 上有很多
解决方案
只需确保您在选择查询中使用数组即可。获取所有记录。例如,
$posts = $this->Employees->find("all")
->contain(["employeePosts" => function($q){
return $q->select(["id", "employee_id", "post_title"]);
}])
->toList();
echo print_r("posts");
这里employee_id 是外键。并且employeePosts 是我在HasMany() 的EmployeesTable 中创建的一个键
$this->hasMany("employeeposts")->setClassName("Posts")
推荐阅读
- amazon-ec2 - GitLab 执行器错误“您缺乏写入系统配置的权限。”
- r - 根据两个不同的字符提取字符串
- apache-kafka - kSqlDB Exactly Once 处理保证
- angular - 只有 Ipad 的角度 cdkDrag 和滚动问题
- css - 我的网站在网站右侧有 css 问题
- r - 当某些向量值为负时,关于几何平均值的问题
- c++ - 在c ++ winrt中获取时区ID
- report - GA4 事件参数图
- c# - 从对话框的 VM 外部更新 Caliburn Micro 中的模态对话框
- loopback - 是否可以将额外的参数传递给 Loopback 拦截器?