Hello
Does anybody know how I can search by the key in json with cake query?
I’m using cakephp JsonType
My model
protected function _initializeSchema(TableSchema $schema)
{
$schema->setColumnType('json_column', 'json');
}
An example of the database data
json_column => [
{
"title": "Lorem",
"note": "Ipsum"
}
]
its searches by the whole string but I would like to search only by title key in this column
$query->find()->where(
function (QueryExpression $exp) use ($title) {
return $exp->like('json_column', "%$title%", ['json_column' => 'json']);
}
)
Is it possible?