Join Without Key-Value Pair

Is it possible to have a join without needing key-value pairs like below?




return $this->hasOne(MyShapes::className(), [])->onCondition('ST_Within(MyPoint, MyShape)');



MyPoint is a Point

MyShape is a Polygon

This would not really be a relation in the way they where designed… What kind of DB can do such a query?

Spatial extensions for MySQL, http://dev.mysql.com/doc/refman/5.6/en/functions-for-testing-spatial-relations-between-geometric-objects.html

Not sure if it helps… can you try creating a DB VIEW in MYSQL and create a model in Yii for the DB View? Views can help for reading/querying data. For inserts/updates write your own codes to hit the base tables.