I have created a function insert on phalcon but when I try to run my API the data cant be insert and I got no error in this code the http route is everything good
public function insertAction()
{
$p = $this->request->getJsonRawBody();
// model
$x = new InvBarangKelompok();
// set data
$x = $this->postData($x, $p);
// validasi data
if (!$x->validation()) {
$messages = $x->getMessages();
$pesan = '';
foreach ($messages as $message) {
$pesan .= ' '.$message->getMessage();
}
return $this->setJsonRespon('terjadi kesalahan', 1);
}
// insert data
if (!$x->create()) {
$messages = $x->getMessages();
$this->dm['error'] = $x->getMessages();
$pesan = '';
foreach ($messages as $message) {
$pesan .= ' '.$message->getMessage();
}
return $this->setJsonRespon('terjadi kesalahan', $pesan, 1);
} else {
return $this->setJsonRespon(null, null, $x);
}
}
postData
andsetJsonRespon
?