Here is my test code trying to save data what I am getting in request, but it is not saving in table.
$json = '{
"isMobileConfirm":false,
"cid":"85036",
"managerid":"12345",
"location":"12.961125000000001,77.64933166666667",
"studentprofilepic":"studentprofilepic_1496989696628",
"studentfrontpic":"studentfrontpic_1496989698785",
"studentbackpic":"studentbackpic_1496989703275",
"govtfrontpic":"govtfrontpic_1496989713175",
"govtbackpic":"govtbackpic_1496989707848",
"selfiepic":"selfiepic_1496989713394",
"extrapic":[
{
"extra_imagepath":"extrapic_1496989714945",
"extra_doctype":"Hostel Bill\/Receipt",
"extra_docremark":"gvvg"
}
],
"loanpic":[
"LFA\/loanpic_1496989716375"
]
}';
$student = Mage::getModel("customer/customer")->load(85036);
// load cmupload
$cmuploads = Mage::getModel("manager/cmuploads");
// decode the json data into arrya
$obj = json_decode($json,true);
echo "<pre>";
var_dump($obj);
// check is array or not
if(is_array($obj)){
foreach ($obj as $key => $value) {
echo $key;
echo $value;
// if not array save data student pics
if(!is_array($value)){
$cmuploads->setCustomerId(85036);
$cmuploads->setFileName('studentprofilepic_1496989696628');
$cmuploads->setFileFilekey('studentprofilepic');
$cmuploads->setManagerId($value->managerid);
$cmuploads->setStatus(1);
$cmuploads->setLocation($value->location);
$cmuploads->setCreatedDate(NOW());
} else if(is_array($value)) {
// If it's array check its loan pic or extra pics
}
}
try {
$cmuploads->save();
}
catch(exception $ex2){
echo "sa";
}
}else {