Active Record with json relation

Hello,

Is there any way to use ActiveRecord relation like this

return $this->hasOne(ReferencedAR::className(), [‘id’ => ‘JSON_VALUE(data, $.referenceField)’]);

I am afraid its not possible with yii

Well solved, its a pitty that almost all methods in ActiveQuery are private and you cant to overide only needed.

As long as JSON_VALUE() returns an integer it is possible :wink:

my bad indeed JSON_VALUE returns a scalar I was confusing it with JSON_QUERY