fix crud
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace backend\modules\company\models;
|
||||
|
||||
use common\classes\Debug;
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
@ -18,7 +19,7 @@ class CompanySearch extends Company
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id', 'status_id'], 'integer'],
|
||||
[['id', 'status_id', 'projectId'], 'integer'],
|
||||
[['name', 'description', 'created_at', 'updated_at'], 'safe'],
|
||||
];
|
||||
}
|
||||
@ -41,7 +42,7 @@ class CompanySearch extends Company
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Company::find();
|
||||
$query = Company::find()->joinWith('project');
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
@ -63,6 +64,7 @@ class CompanySearch extends Company
|
||||
'status_id' => $this->status_id,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
'project.id' => $this->projectId
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'name', $this->name])
|
||||
|
Reference in New Issue
Block a user