A contact calls and asks for different properties. I want to query all properties "asked" by a concrete contact. Is there a way to do this query statically without use SQL? With hasMany, find, or other magic method…
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'contact_id' in 'where clause'
The SQL being executed was: SELECT * FROM `property` WHERE `contact_id`=1
so I assume it’s not doing the join with PhoneCall table…
as i understand your requirement.Im not geeting this.
Find below what i have assumed,
@ PropertyPhoneCall Model
public function getPropertydata()
{
return $this->hasOne(Property::className(), ['property_id' => 'property_id']);
}
public function getPhonecalldata()
{
return $this->hasOne(PhoneCall::className(), ['phonecall_id' => 'phonecall_id']);
}
And then I can loop over PropertyPhoneCall and get related Property with a $propertyPhoneCall->property. This way I cannot order by any Property field, but I can reorder via PHP.