Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Need Help With An Unusual Table Relationship And Relations()

$
0
0
I'm trying to do something unusual with relations() and I can't get it to cooperate. I have a table where the foreign key is an array (I know, unusual design, but it has major performance advantages in this specific case.)

The actual join syntax I need to use is: "select tag from tags join pictures on (tags.tag_id = any (pictures.tags)) where pid=xxx". I am trying to get a array of Tags table objects from inside the picture table (one picture has many tags) in the form of $pictureObject->arrayOfTagObjects

I have tried doing various things with the relations() array, but I can't get it to select properly. When I do the $pictureObject->arrayOfTagObjects, the query does not join the picture table, Yii instead tried to query just the tags table using the array, or picture id as a foreign key. How can I change this behavior to generate a query like the one above?

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>