教义关系问题
我正在尝试运行此查询:
$record = Doctrine_Query::create()
->select('m.*')
->from('Modification m')
->leftJoin('m.Location l')
->leftJoin('l.Site s')
->where('CONCAT(s.baseUrl, s.modUrlPrefix, l.urlSuffix) = ?', (string)$url)
->fetchOne();
但是,它失败并出现错误
Doctrine_Table_Exception:未知关系别名位置
yaml 文件中的关系如下所示(两个一对多关系。修改和站点都有许多位置):
Site:
columns:
id:
type: integer
primary: true
autoincrement: true
Modification:
columns:
id:
type: integer
primary: true
autoincrement: true
Location:
columns:
modification_id: integer
site_id: integer
relations:
Modification:
foreignAlias: Locations
Site:
foreignAlias: Locations
Category:
foreignAlias: Locations
我没有将哪些内容放入我需要的 yaml 文件中?据我所知,我已经按照文档的建议设置了 yaml 文件。
I am trying to run this query:
$record = Doctrine_Query::create()
->select('m.*')
->from('Modification m')
->leftJoin('m.Location l')
->leftJoin('l.Site s')
->where('CONCAT(s.baseUrl, s.modUrlPrefix, l.urlSuffix) = ?', (string)$url)
->fetchOne();
However, it fails with the error
Doctrine_Table_Exception: Unknown relation alias Location
The relationships in the yaml file looks like this (Two one to many relationships. Both Modification and Site have many Locations):
Site:
columns:
id:
type: integer
primary: true
autoincrement: true
Modification:
columns:
id:
type: integer
primary: true
autoincrement: true
Location:
columns:
modification_id: integer
site_id: integer
relations:
Modification:
foreignAlias: Locations
Site:
foreignAlias: Locations
Category:
foreignAlias: Locations
What am I not putting in the yaml file that I need to? As far as I can make out, I have setup the yaml file the same as the documentation suggests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是 m.Locations 吗?
你的yaml指定了这个别名,而不是位置
我从来没有读过yaml文件,所以我不确定
it's m.Locations no?
your yaml specifie this alias, not Location
i never read the yaml file, so I'm not sure