$this->contactID]); return ''.$this->name.''; } public function rules(){ return [ [['name','email','shoppingSystem','parentInstitution'],'required'], ['email','email',], [['notes','phone'],'default','value'=>''], ]; } public function getParentInstitution() { return $this->hasOne(InstitutionForm::className(), ['parentInstitutionID' => 'fk_parentInstitutionID']); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ContactForm::find()->select('contacts.*,contacts.name as Updateurl, parentInstitution.*')->joinWith('parentInstitution'); //ContactForm::find()->leftJoin('parentInstitution', '); /* $customers = Customer::find() ->select('customer.*') ->leftJoin('order', '`order`.`customer_id` = `customer`.`id`') ->where(['order.status' => Order::STATUS_ACTIVE]) ->with('orders') ->all(); */ $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => ['attributes' => ['institutionFullName','Updateurl','shoppingSystem']] ]); $this->load($params); if (!$this->validate()) { return $dataProvider; } return $dataProvider; } }