The example here:
https://docs.phalcon.io/en/latest/reference/models.html#creating-your-own-behaviors
Says that the $models should be defined as an instance of ModelInterface, I think this is not valid any more for Phalcon version 0.9.1, could you guys check this?
I'm getting this error all the time:
Fatal error: Declaration of Models\Behaviors\Timestampable::notify() must be compatible with that of Phalcon\Mvc\Model\BehaviorInterface::notify() in ..../app/models/Behaviors/Timestampable.php on line 10
Here is the code:
<?php
namespace Models\Behaviors;
use \Phalcon\Mvc\ModelInterface, \Phalcon\Mvc\Model\Behavior, \Phalcon\Mvc\Model\BehaviorInterface;
class Timestampable extends Behavior implements BehaviorInterface {
public function notify($eventType, ModelInterface $model)
{
var_dump($eventType);die;
if ($eventType == 'beforeCreate') {
var_dump($model);die;
$model->created = date('Y-m-d');
}
}
}
as soon as I remove ModelInterface type, the error disappear.