Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fetching errors from related models
  • How can I fetch all validation errors during saving model with related models.
                $partner = new Model_Partners();
                
                $partner->partner_id        =   FCore\Input::post('partner-id');
                $partner->username          =   FCore\Input::post('partner-login');
                $partner->password          =   FCore\Input::post('partner-password');
                $partner->group             =   FCore\Input::post('partner-group');
                $partner->email             =   FCore\Input::post('partner-email');
                
                $partner->contacts          =   new Model_Partners_Contacts();
                $partner->contacts->homePhone               =  FCore\Input::post('partner-home-phone');
                $partner->contacts->mobilePhone             =  FCore\Input::post('partner-mobile-phone');
                $partner->contacts->addressOfDelivery       =  FCore\Input::post('partner-address-of-delivery');
                
                $partner->information       =   new Model_Partners_Informations();
                $partner->information->surname              =   FCore\Input::post('surname');
                $partner->information->name                 =   FCore\Input::post('name');
                $partner->information->middlename           =   FCore\Input::post('middlename');
                $partner->information->gender               =   FCore\Input::post('gender');
                $partner->information->birthday             =   FCore\Input::post('birthday');
    
                try {
                    
                    $partner->save(null, true);
                    
                    FCore\Session::set_flash('success', 'Partner\'s profile has been saved');
                    
                } catch(Orm\ValidationFailed $e) {
                    
                    FCore\Session::set_flash('error', 'Huston, something went wrong...');
                    
                }
    

Howdy, Stranger!

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