有两种型号Order
和OrderDeliveryData
。他们是相关的
public function getOrderDeliveryData(){
return $this->hasOne(OrderDeliveryData::className(), ['order_id' => 'order_id']);
}
如何在搜索模型中做这样的事情(现在是一个错误)?
$query = Order::find()->andWhere(['orderDeliveryData.order_delivery_data_courierId' => ("51")])
->andWhere(['order_status' => ("send")]);
答案 0 :(得分:1)
尝试:
$query = Order::find()->with(['orderDeliveryData' => function($query){
$query->where([ 'order_delivery_data_courierId' => '51' ]);
}])->where(['order_status' => "send"]);
答案 1 :(得分:1)
您需要在select * where {
?s a <http://dbpedia.org/ontology/School> .
?s ?p ?o
filter(?p not in (rdf:type, owl:sameAs, rdfs:label, rdfs:comment, rdfs:seeAlso))
}
模型上编写联接或joinWith
才能在其中使用其列。
OrderDeliveryData