开始学习cakephp3。 有两个表
Task
-id
-task_type
和
Task_content
-id
-task_id
-some_key
-sove_val
在结果中我想得到一些对象,它看起来像:
{
id: Task.id,
type: Task.type,
title: Task_content.some_val (where some_key == 'title')
content: Task_content.some_val (where some_key == 'conent')
}
获取此对象的最佳方法是什么,只需通过“get”获取任务?
最佳答案
您需要制定一种行为来处理这个问题。您可以从 TranslateBehavior 中获得灵感,它的作用非常相似:
https://github.com/cakephp/cakephp/blob/master/src/ORM/Behavior/TranslateBehavior.php
关于php - 使用链接表值扩展模型。在cakephp3中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29572588/