您好我正在尝试在 Cakephp3 中查找数据
我正在做的是我想查找具有选定列的数据,这些列是产品名称、产品代码和小图像 url。
$contain = [
'Image' => [
'ImageFile'
]
];
$products = $this->Product->find()
->contain($contain)
->select(['Product.name', 'Product.product_code', 'Product.Image.ImageFile.small_image_url'])
->where(['Product.name Like' => '%'.$keyword.'%']);
但是,我得到了一个错误
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Product.Image.ImageFile.small_image_url' in 'field list'
我不知道如何解决这个问题。
提前致谢!