Phalcon behaviours not working

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Phalcon behaviours not working



I'm trying to get some Phalcon PHP behaviour going, but it's not working in my model as expected. Here's the initialize function of my model:


public function initialize()
{
$this->addBehavior(
new Timestampable(
[
'beforeCreate' => [
'field' => 'created_at',
'format' => 'Y-m-d H:i:s',
]
]
)
);

$this->addBehavior(
new Timestampable(
[
'beforeCreate' => [
'field' => 'updated_at',
'format' => 'Y-m-d H:i:s',
]
]
)
);
}



This does not save the timestamps to the database when I create a new instance in my code. The lock is saved like this:


$lock = new TradesLocks();
$lock->trade_id = $id;
$lock->save();



I've gone over the PhalconPHP docs and also cannot see what I'm doing wrong. How come it does not behave like expected?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

'Series' object is not callable Error / Statsmodels illegal variable name