Hi,
i doing personal page module.
this is the my edit profile page code.
i have error in 126.call to undefind error.
this is error line.
$personal->$personal=getDataInArray();
what is the proble?
any body plz help me.
public function executeEdit(sfWebRequest $request)
{
$this->frm_edit = new PersonalForm();
$personal=array();
$error=array();
//if they submitted the form
if($request->isMethod("post")) {
//if they want to change their detail
// if($request->getParameter("type") =="detail") {
//get the submitted values
$personal=$request->getParameter("personal");
//check birth date validation
/* if(!$personal["birth_date_day"] || !$personal["birth_date_month"] || !$personal["birth_date_year"]) {
$error["birth_date"]=sfConfig::get("app_notice_label_empty");
}
elseif (!checkdate($personal["birth_date_month"], $personal["birth_date_day"], $personal["birth_date_year"])) {
$error["birth_date"] = sfConfig::get("app_notice_label_not_valid");
}
/* // check country validation
if (!$personal["country_id"]) {
$error["country_id"] = sfConfig::get("app_notice_label_empty");
}
elseif (!Doctrine::getTable("Country")->find($personal["country_id"])) {
$error["country_id"] = sfConfig::get("app_notice_label_not_valid");
}
// check zone validation
if ($personal["zone_id"]) {
$zone = Doctrine::getTable("Zone")->find($personal["zone_id"]);
if (!$zone || $zone->getCountryId() != $personal["country_id"]) {
$error["zone_id"] = sfConfig::get("app_notice_label_not_valid");
}
}*/
if (!$personal["occupation"]) {
$error["occupation"] = sfConfig::get("app_notice_label_empty");
// check about me validation
if (!$personal["about_me"]) {
$error["about_me"] = sfConfig::get("app_notice_label_empty");
}
// check total error
/*if (count($error) == 0) {
$detail = $this->getUser()->getAttribute("detail");
// change the value for birth_date so it will be compatible with mysql
$personal["birth_date"] = date("Y-m-d", strtotime($personal["birth_date_year"] . "-" . $personal["birth_date_month"] . "-" . $personal["birth_date_day"]));
$detail->saveDataInArray($personal);
$this->getUser()->setAttribute("detail", $detail);
$this->getUser()->setFlash("notice_edit_profile", sfConfig::get("app_notice_edit_profile_success"));
}*/
}
else {
$personal->personal=getDataInArray();
// $personal = $this->getDataInArray();
}
// pass the variables for the template
$this->personal = $personal;
$this->error = $error;
$this->countries = Doctrine::getTable("Country")->findAll();
//$this->sex = Doctrine::getTable("Personal")->getSexInArray();
//$this->relationshipStatus = Doctrine::getTable("Personal")->getRelationshipStatusInArray();
}
}
class Personal extends BasePersonal
{
public function getDataInArray()
{
$data = array();
$data['user_id'] = $this->user_id;
// $data['Firstname'] = $this->full_name;
$data['sex'] = $this->sex;
$data['birth_date'] = $this->birth_date;
$data['relationship_status'] = $this->relationship_status;
$data['country_id'] = $this->country_id;
$data['zone_id'] = $this->zone_id;
$data['occupation'] = $this->occupation;
$data['about_me'] = $this->about_me;
$data['what_i_do'] = $this->what_i_do;
$data['what_i_go'] = $this->what_i_go;
return $data;
}
public function saveDataInArray($data)
{
//$this->full_name = $data['full_name'];
$this->sex = $data['sex'];
$this->birth_date = $data['birth_date'];
$this->relationship_status = $data['relationship_status'];
$this->country_id = $data['country_id'];
$this->zone_id = $data['zone_id'] == '' ? null : $data['zone_id'];
$this->occupation = $data['occupation'];
$this->about_me = $data['about_me'];
$this->what_i_do = $data['what_i_do'];
$this->what_i_go = $data['what_i_go'];
$this->save();
}
}