views:

112

answers:

1

Trying to use the modules: Jelly-Auth and Jelly-Formo is causing 2 errors. Depending on how I arrange my boostrap file I can get rid of one error or the other but not both...

Error 1: Auth works fine, formo doesn't: http://wellcommentedcode.com/stack_questions/formo.jpg

Kohana::modules(array(
  'database'    => MODPATH.'database',   // Database access

  'jelly'       => MODPATH.'jelly',   // Jelly ORM

  'jelly-auth'  => MODPATH.'jelly-auth',       // Basic authentication & Jelly
  'auth'        => MODPATH.'auth',       // Basic authentication

  'formo-jelly' => MODPATH.'formo-jelly',   // Easy forms & Jelly
  'formo'       => MODPATH.'formo',   // Easy forms
  ));

Error 2: Formo works fine, auth breaks on validation: http://wellcommentedcode.com/stack_questions/formo-auth.jpg

Kohana::modules(array(
  'database'    => MODPATH.'database',   // Database access

  'formo-jelly' => MODPATH.'formo-jelly',   // Easy forms & Jelly
  'formo'       => MODPATH.'formo',   // Easy forms

  'jelly'       => MODPATH.'jelly',   // Jelly ORM

  'jelly-auth'  => MODPATH.'jelly-auth',       // Basic authentication & Jelly
  'auth'        => MODPATH.'auth',       // Basic authentication
));

Any help would be highly appreciated... thanks...

Update: I got Error 2 fixed in a hackish kind of way... a better method would be appreciated...

I simply commented out line 81 and 82 of formo-jelly/classes/jelly/model.php

I'd like to be able to use jelly-formo validation... but as it's causing problems with Auth validation right now... I'm willing to scrap those two lines for the time being...

81: if ( ! $this->form->validate(TRUE))
82:     throw new Validator_Exception($this->form->errors(), 'Failed to validate form');
A: 

You should always use try...catch() blocks when saving Jelly objects:

try {
    $model->save();
    // object saved successfully
}
catch (Validate_Exception $e)
{
    // get validation errors
    $errors = $e->array->errors();
}
biakaveron
thanks for the advice but that doesn't really do much to help remedy the problem at hand...
Serhiy
Its for your error2 situation. Auth->login() tries to save User object - use try...catch().
biakaveron
I see... thanks... didn't get that... haha.. I just commented out the two lines of code...
Serhiy

related questions