我必须在 cakephp 中包含两个具有 json 字段值的模型

I have to contain two models with json field value in cakphp

log table with product id product table 我的日志 tables 包含的数据字段具有 json 类似

的数据
{"product-id":"14","product-name":"test","product-url":"\/projects\/test\/products\/lecture-details\/8","product-type":"lecture","product-price":"0"}

我想使用存储在数据 file.How 中的产品 ID 加入产品 table,我可以这样做吗?

log table "product-id": "14" 此字段需要包含在产品中 table.

$getQuery = $this->Log->find('all')->matching('Users', function ($q) { return $q->where(['Users.is_deleted' => 'n']);})->contain(['Users','Products'])->select(['user_id' => 'Users.id', 'username' => 'Users.username','fname' => 'Users.fname','lname' => 'Users.lname', 'email' => 'Users.email','view_date' => 'Log.dt_created_on','data' => 'Log.data'])->where($conditions);

添加这段代码日志关联模型

$this->hasOne('Products', [
      'className' => 'Products',
      'foreignKey' =>false,
      'conditions' => array("Products.id=JSON_VALUE(cast(log.data as nvarchar(256)),'$.\"product-id\"')")
]);