You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for example I have three tables. order , item , order_item
Class Order extends ActiveRecord
{
public function getItems()
{
return $this->hasMany(Item::className(), ['id' => 'item_id'])
->viaTable('order_item', ['order_id' => 'id']);
}
}
Order::findOne(1)
The querys
1.select * from order where id=1;
2.select * from order_item where order_id = 1;(empty result)
3.select * from item where 0=1; (why have this? );
I looked the source code
What is the expected result?
What do you get instead?
Additional info
Q
A
Yii version
2.0.5
PHP version
7.1.9
Operating system
The text was updated successfully, but these errors were encountered:
3.select * from item where 0=1; (why have this? );
the condition in where could be much more complex than in your case, it is not easily possible for Yii to figure out whether a query result will be empty, so we build a query and let the database decide.
It might be possible to optimize this in some way though.
What steps will reproduce the problem?
for example I have three tables. order , item , order_item
The querys
1.select * from order where id=1;
2.select * from order_item where order_id = 1;(empty result)
3.select * from item where 0=1; (why have this? );
I looked the source code
What is the expected result?
What do you get instead?
Additional info
The text was updated successfully, but these errors were encountered: