CakePHP:数据库关联1对多链接到1对1

时间:2018-06-04 11:05:49

标签: cakephp model associations table-relationships

  

3张表:

PaymentRequests
PaymentPurchaseOrders
PurchaseOrders
  

目前的关系:

PaymentRequests -> HasMany -> PaymentPurchaseOrders -> BelongsTo ->PurchaseOrders
  

控制器上的当前代码:

$Get = $this->PaymentRequests->find(
    'all', [
        'contain'=>['PaymentPurchaseOrder'=>['PurchaseOrder']
    ]);
  

问题:

查询太重了。我想在模型中将其关联起来,但我不知道如何。

0 个答案:

没有答案