Assume I want to save in DB the registration time of user.
CREATE TABLE user
(
id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
email VARCHAR(255) NOT NULL,
createdDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
Why it does not work?
<?php
// model
class User extends \Phalcon\Mvc\Model
{
/**
*
* @var integer
*/
public $id;
/**
*
* @var string
*/
public $email;
/**
* @var string
*/
public $createdDate;
...
}
// controller
$userA = new \Auth\Models\User();
$userA->email = '[email protected]';
$result = $userA->create();
// why result === false and user is not saved?
if I remove $createdDate field from here and from DB - all is working correctly, user saved.