darioo
(Timmy Dario)
1
I’ve read tutorial here http://www.yiiframework.com/doc-2.0/guide-db-active-record.html
and saw this
$orders = Order::find()->joinWith('customer')->orderBy('customer.id, order.id')->all();
I tried to do similar with my query but it doesn’t work, not sure why.
Request::find()->joinWith('relationIDlocation')->where(['relationIDlocation.IDuser'=>$Locations->IDuser])->count();
Could someone point out why is that. Everything is set up properly.
public function getRelationIDlocation()
{
return $this->hasOne(Locations::className(), ['ID' => 'IDlocation']);
}
What is your goal and most what does not work?
It’s not clear.
darioo
(Timmy Dario)
3
My goal is to count number of records in different table where IDuser is for example 2,3,4…
This doesn’t work
'relationIDlocation.IDuser'
Pasman
(Pasman P)
4
Show detailed error message.
darioo
(Timmy Dario)
5
This is full error message
Change
Request::find()->joinWith('relationIDlocation')->where(['rre_locations.IDuser'=>$Locations->IDuser])->count();
darioo
(Timmy Dario)
7
I know about it, I used
[Locations::getTableSchema()->name.'.IDuser'=>Yii::$app->user->getId()]
I thought there is another solution, but thank you.