Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validation add_model method
  • I'm having some trouble with the add_model method on the validator here is a snippet of where the problem is:
    ...
    $form = Fieldset::factory();
    $form->validation()->add_model('Model_Member');
    ...
    
    this causes the error:
    Input for add_callable is not a valid object or class.
    
    Can anyone advise on how to properly use the add_model method? Any help would be greatly appreciated.
  • That would suggest it's not a valid classname. The Validation::add_model() uses Validation::add_callable() and that checks if the given value is either an object or a valid class using is_object() and class_exists(). In other words: the class you're trying to get doesn't exist. (otherwise class_exists() would load it)
  • Thanks for that it turns out I actually spelled something wrong and didn't notice it. I am now running into another related problem. I have it finding the class / model correctly but now it doesnt recognize the validation rules I am trying to add to it. It gives me this error:
    Notice: Invalid rule "unique" passed to Validation, not used.
  • Quite simply that means Validation can't find your Unique rule. Did you follow the documentation and is it named correctly? If that all matches I'm going to need to know way more and have some code-snippets of your implementation to know what's wrong, that's impossible to find out based on general error messages without context.
  • are you sure you have followed the rules described here: http://fuelphp.com/docs/classes/validation.html
    ( extending validation class )

Howdy, Stranger!

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

In this Discussion