I use phalcon & angular together. I have a form in angular:
<!--rest of form-->
<label class="radio-inline" *ngFor="let m of marriageCtrl">
<input type="radio" formControlName="marriage" [value]="m.value">{{m.label}}
</label>
value is boolean: true/false. When I submit it to form, I get values in phalcon:
public function SaveAction()
{
$formValues = $this->request->getJsonRawbody();
$person = new Person();
foreach($formValues as $key=>$val)
{
$person->$key = $vale;
}
//Rest of Person model properties
if($person->save() == true) {
return ["message"=>"Person saved Successfully!"];
}else {
$message = '';
foreach($person->getMessages() as $msg) {
$message = $message.$msg->getMessage()
}
return ['message'=>$message];
}
}
It is ok for other properties but for marriage which is boolean returns:
marriage is required
But if I var_dump()
person object, It shows:
["marriage"]=>
bool(true)