Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Add two model to a Fieldset
  • Hi,

    I want to add two model to a fieldset :

    $form = \Fieldset::forge('page_form', array('form_atributes' => array('class' => 'form-horizontal')));
    $form->add_model('Model_Page');
    $form->add_model('Model_Horaires');

    But i have this notice :

    Notice: Field with this name exists already in this fieldset: "created_at". in PKGPATH/orm/classes/observer/validation.php [144]: add
    Notice: Field with this name exists already in this fieldset: "updated_at". in PKGPATH/orm/classes/observer/validation.php [144]: add

    It's okay because i have twice "updated_at" and "created_at" in Model_Page and Model_Horaire.

    But what i can do ? 

    My idea : Remove created_at and updated_at field after the first add_model(). But Fieldset class doesn't have a remove method ?
  • I've resolve my issue :

    $form = \Fieldset::forge('page_form', array('form_atributes' => array('class' => 'form-horizontal')));
    $form->add_model('Model_Page');

    $formHoraire = \Fieldset::forge('horaire_form');
    $formHoraire->add_model('Model_Horaires');
    $form->add($formHoraire);

    Sorry for this post ;-)

Howdy, Stranger!

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

In this Discussion