codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

problem generating error with Callbacks/Observers

Open Cedric-ruiu opened this issue 11 years ago • 0 comments

Hi,

If you put an bad method name in callback/observer array (tested with before_create) before created_at or/and updated_at , nothing error hapening, and all data given in insert is lost. The result for an insert is a blank entry in DB. I don't understand why nothing error hapening with this configuration. Look following exemples, the first don't generate error, but the second and third it's ok (error displaying). I have to sleep now i can't find the problem...

class Exemple1 extends MY_Model
{
    ...
    protected $before_create = array('foop', 'created_at', 'updated_at');

    public function foo($data)
    {
        return $data;
    }
}

These followings are ok :

class Exemple2 extends MY_Model
{
    ...
    protected $before_create = array('foop'');

    public function foo($data)
    {
        return $data;
    }
}

class Exemple3 extends MY_Model
{
    ...
    protected $before_create = array('foop', 'bar');

    public function foo($data)
    {
        return $data;
    }

    public function bar($data)
    {
        return $data;
    }
}

(sorry for my english)

Cedric-ruiu avatar Feb 13 '13 23:02 Cedric-ruiu