Strange behavior model

I have this table:

CREATE TABLE IF NOT EXISTS `action_history` (
  `id` int(11) NOT NULL,
  `timestamp` int(11) NOT NULL,
  `action` enum('call','logout','in_game','reg') NOT NULL,
  UNIQUE KEY `id` (`id`)

And this model:

use Phalcon\Mvc\Model\Behavior\Timestampable;

class ActionHistory extends \Phalcon\Mvc\Model {
    public $id;
    public $timestamp;
    public $action;

    public function getSource() {
        return 'action_history';

    public function initialize() {
        $this->hasOne("id", "Users", "id", array(
            "alias" => "User"

        $this->addBehavior(new Timestampable(array(
            "beforeValidateOnCreate" => array(
                "field" => "timestamp"

    public function beforeValidateOnCreate() {
        $this->action = 'reg';

    public function beforeValidate() {
        // just for testing thats validation not work
        $this->timestamp = time();


And i have this troubles:

/** @var $user Users */
$ah = new ActionHistory();
$ah->user = $user; // store this var in field "user" in model, not as related id
$ah->id = $user; // -> fatal error on save by Users don't have __toString()
$ah->id = $user->id; // setted as string and converted in 0
$ah->id = (int) $user->id; // work!
// $ah->save() or $ah->create() don't have any differences

And even more: behavior or beforeValidate () do not fire at all (checked through xdebug), and immediately takes off gives an error "timestamp is required".


oh my... Ok, but what about relation with another model? Why don't work?


Could you please elaborate your question?