Actually i need to increase the performance speed in my web application developed by using Yii 2 .0 Framework
I have made a CRM using Yii2 Framework, That contains a large database, in that database particular table called Employee
contains 20,000 employee records, so while executing query to retrieve data from table, it takes time to execute.
This makes it troublesome for me to use this application.
UPDATED code:
public function actionLists($id)
{
$countClaimprocess = Employee::find()
->where(['id' => $id])
->count();
$claimprocess1 = Employee::find()
->select('employee_id')
->where(['id' => $id])
->one();
$claimprocess2 = Employee::find()
->select('importcompany_id')
->where(['id' => $id])
->one();
$claim2 = $claimprocess2->importcompany_id;
$claim = $claimprocess1->employee_id;
$claimprocess = Employee::find()
->where("employee_id = '$claim' and importcompany_id = $claim2")
->andwhere(" status != 'Deleted' ")
->all();
}
The above code is used for a dependent dropdown, that means if a admin select a company_name
, it will show a dependent employee_code
belonging to that company
, and then again admin selects a employee_code
, it will show the dependent employee_name
and their family
members name.