Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validate required related field
  • Hi, Whats the best way to validate a required a related field (belongs_to)? My Model
    http://pastebin.com/zRhUzZrY I've tried to set the department_id to required but I't throws an exception when I save and I only assign an Department instance to the field. $this->user = Model_User::find_or_create_with_username($ldap_fields);
    $this->user->department = Model_Department::forge();
    $this->user->department->name = "shdk";
    $this->user->name = "ghsd";
    $this->user->save(); // throws ValidationError -> department_id not set Whats the best way to do this?
    Or is the only way to manually set the department_id before save? Thank you!

Howdy, Stranger!

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