Guest User

Untitled

a guest
Jan 12th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. ublic function actionCreate()
  2. {
  3. $model_agent =new AgentProfile;
  4. $model_user =new User;
  5.  
  6. // Uncomment the following line if AJAX validation is needed
  7. // $this->performAjaxValidation($model);
  8.  
  9. if(isset($_POST['AgentProfile'], $_POST['User']))
  10. {
  11. $model_agent->attributes=$_POST['AgentProfile'];
  12. $model_user->attributes=$_POST['User'];
  13.  
  14. $model_user->role = $model_user::AGENT_ROLE;
  15. $model_user->type = $model_user::PROFILE_AGENT;
  16.  
  17. $valid=$model_agent->validate();
  18. $valid=$model_user->validate() && $valid;
  19.  
  20. if($valid){
  21. $model_agent->safe(false);
  22. $model_user->safe(false);
  23. $this->redirect(array('view','id'=>$model->agent_profile_id));
  24. }
  25.  
  26.  
  27. }
  28.  
  29. $this->render('create',array(
  30. 'model_agent'=>$model_agent,
  31. 'model_user'=>$model_user,
  32. ));
  33. }
Add Comment
Please, Sign In to add comment