Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Help with modifying form data
  • I'm new to Fuel and ORM's.
    I am using the observer feature in which I want to set some data to be inserted into a table along with my submitted form data. Not all data in the table is filled out in the form, but based on options chosen, fields need to set.

    class Model_Genre extends \Orm\Model
    protected static $_properties = array(

    protected static $_observers = array(
      'Orm\Observer_Self' => array(
        'events' => array('before_save'),

    public function _event_before_save() {
    self::$_properties['lft'] = 100;

    Just as a test, I wanted to see if this was setting my lft column to 100. But it does not seem to be firing since this column is NULL once its gets inserted.

    Any ideas what I am doing wrong?
  • HarroHarro
    Accepted Answer
    The object data is not in the properties array, it just holds the data definition.

    An observer gets passed the object it observes:
    public function _event_before_save(Model $obj)
        $obj->lft = 100;

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion