Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Observer_Self _event_after_save() fires twice
  • Hey, im using 1.0 dev and it seems _event_after_save() fires twice when its a related save. For example:
                $thread = Model_Thread::factory();
    
                $thread->title          = $form->validated('title');
                $thread->slug           = \Inflector::friendly_title($form->validated('title'), '-', true);
                $thread->user_id        = 1;
                $thread->node_id        = 2;
                $thread->posts[]        = Model_Post::factory(array(
                        'user_id'       => 1,
                        'node_id'       => 2,
                        'content'       => $form->validated('content'),
                ));
    
                $thread->save();
    
    

    Model_Post:
        public function _event_after_save()
        {
            print_r('moo'); //is printed twice
        }
    

    if it means anything 'before_save' has the same problem, 'before_insert'. works as expected.

Howdy, Stranger!

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