Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Null Records on save?

Hi... I'm trying to get familiar with the framework by working through the tutorials. Got everything compiled and installed and started working through the first example. Everything works fine up until the save record. Save doesn't seem to be working correctly and I can't figure out why..

tutorial I've followed to the letter:

In the last step, I enter some data in the two text fields and get the following: Sorry, the following problems were generated: name is required email is required

So I added an echo printr($POST); in the controller/registerAction and end up with this output: Array ( [name] => test [email] => test ) 1Sorry, the following problems were generated: name is required email is required

I removed the "not null" requirement and it saves an empty record... regardless of what is in the $_POST array Array ( [name] => test [email] => test ) 1Thanks for register!

Any idea on how I can start tracking down the issue?


In 1.0.x, the mass assignment was disabled due to a security issue, you can directly assign the values to the model:

$user = new Users();
$user->name = $this->request->getPost("name");
$user->email = $this->request->getPost("email");

In 1.1.0 this issue was fixed.

worked great... thank you! I'll work on pulling in 1.1.0 too... just pulled the master branch to get started. Thx!

edited Oct '14

Hi, I'm having the same problem as @ceallred. I'm using Phalcon 1.1.0, and following the same tutorial. I tried manual assignment as suggested, however this did not help, it still considered the "email" field to be blank. If i allow the table fields to be blank, however, it will save fine.

Controller function:

public function registerAction(){

    $user = new Users();

    $user->name = $this->request->getPost('name');
    $user->email = $this->request->getPost('email');



<?php echo Tag::form("signup/register"); ?>

    <label for="name">Name</label>
    <?php echo Tag::textField("name") ?>

    <label for="name">E-Mail</label>
    <?php echo Tag::textField("email") ?>

    <?php echo Tag::submitButton("Register") ?>




class Users extends \Phalcon\Mvc\Model{



Hi Edward, if you want compare the code with the one in this repository, maybe there is a typo somewhere there,