save validate

Hi all How to remove validate when save $user = new Users(); $user->save(array( 'username' => 'admaaa', 'profilesId' => 1, 'email' => '[email protected]', )); User was created successfully, but $user = new Users(); $user->save(array( 'username' => 'admaaa', 'profilesId' => 1,

        ));

email is required , althought i not validate email in model, form....

Is the email field in your database set as NOT NULL? If so, Phalcon will validate the email as required implicitly.

To disable this behavior, should you choose, add this to your bootstrap:

\Phalcon\Mvc\Model::setup([
    'notNullValidations' => false
]);


37.8k

Hi Brian Seymour after setup \Phalcon\Mvc\Model::setup([ 'notNullValidations' => false ]); Integrity constraint violation: 1048 Column 'email' cannot be null

If that field must be set to not null, have a look at this post for a solution. http://forum.phalconphp.com/discussion/747/what-is-the-correct-way-to-set-default-value-for-not-null-