Mvc\Model::addBehavior

public addBehavior (Phalcon\Mvc\Model\BehaviorInterface $behavior)

Setups a behavior in a model

<?php

use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Behavior\Timestampable;

class Robots extends Model
{

   public function initialize()
   {
    $this->addBehavior(new Timestampable(array(
            'onCreate' => array(
                    'field' => 'created_at',
                    'format' => 'Y-m-d'
            )
    )));
   }
}
doc_Phalcon
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.