I am old school. In the past I generated all my own queries and I’m real good at it, also debugging them. So all this
framework cruft seems a bit burdensome. Anyway I have a rule which I basically modeled after the blog example, the idea is to get all the tags. The Tag table just has id and tagText, since its Many_MANY I have a join table. So
I put this rule:
'tagFilter' => array(self::MANY_MANY, 'Tag', 'MainTag(mainId, tagId)',
'together'=>true,
'joinType'=>'INNER JOIN',
'condition'=>'??.tagText=:tag', //??
It’s borking thus when it tries to do it:
[font="Impact"]CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens[/font]
All I see is the code that invokes the rule that caused it which is not helpful because I already KNOW that.
I can’t see the actual database queries.
In the end what I want is
SELECT tagText from Tag t INNER JOIN MainTag mt ON t.id = mt.tagId WHERE mt.mainId = <whatever the id is for the AR>
If I had some way to see what prepared query it is actually generating I could figure these things out.
Then obviously after the data has been given to the query I could also see the actual query MySQL is trying to run.
I don’t understand ‘together’ and I don’t understand condition. What are they referring to.
Is there some debug option to make it actually poot out the queries?