before save is not calling after update to 2.0.1

cebe i dont know i m doing right or not but before save is not working

below is code

controller code

public function actionCreate()


{


$model = new Employee();          


  if ($model->load(Yii::$app->request->post()) && $model->save()) {


      return $this->redirect(['view', 'id' => $model->id]);


} else {


    echo "false";


    return $this->render('create', [


        'model' => $model,


    ]);


}

}

model code

 public function beforeSave($insert)


 {


if (parent::beforeSave($insert)) {

$this->emp_no="EMP0001";

$this->institution_id=1;

$this->user_id=1;


return true;


} else {

return false;

}

}

What do you mean "is not working"?


beforeSave()

called after validation. Check your validation.

it was working in 2.0.0 but when i upgrade to 2.0.1 it is not working and default implementation will trigger an EVENT_BEFORE_INSERT event when $insert is true,my rules are fines

i got my answer but i did nt get this how it is done

i just changed controller code to below

public function actionCreate()

{

$model = new Employee();

if ($model->load(Yii::$app->request->post())) {

$model->save(false); // this line i have changed so i have to set false then so beforesave will trigger

return $this->redirect([‘view’, ‘id’ => $model->id]);

} else {

echo "false";

return $this->render(‘create’, [

‘model’ => $model,

]);

}