سؤال

Does anyone knows how to get pre_save() or pre_validate() to work in my model? I have the code below in the model, but it is never called.

protected function pre_validate($data)
{
    //die("asefeg");
    $data->idRegistrant = Session::get('idRegistrant', null);
    return $data;
}
هل كانت مفيدة؟

المحلول

The ORM does not have a pre_save() method like the CRUD model does. For this functionality you want to look into implementing an observer. Plenty of info can be found about this in the fuelphp docs

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top