It works good for me for inserts and updates (and deletes).
When you do an insert it looks like this:
$request = $this->request;
if (!$request->isPost()) {
// Show the form
} else {
// Try to add the robot
$robot = new Robots();
$robot->name = $request->getPost('name', 'string');
// etc
if($robot->create() == false) {
foreach ($file->getMessages() as $message) {
// flash your message
}
// Keep the posted values
Phalcon\Tag::setDefaults(get_object_vars($robot));
}else{
// Insert successful
}
Updates are the same, except you load the robot first and pre-populate the fields, otherwise its the same:
$robot = Robots::findFirstById($id);
if (!$request->isPost()) {
Phalcon\Tag::setDefaults(get_object_vars($robot));
}
(Sorry, not sure why my code isn't getting rendered right...)