more than one has_many relationship model
i want to add multiple relationship tables in a single model, and i did it like
public $has_many = array(
'Salt' => array('salts/salts_model','relationships_model'=>'compositions/compositions_model'),
'Salt Values' => array('saltvalues/saltvalues_model','relationships_model'=>'saltvaluecompositions/saltvaluecompositions_model')
);
the list boxed working fine, the salt list box is working fine and saving data in the compositions relationship table, but the not in the saltvaluecompositions table, but showing the data in listbox, am i missing anything ?
Comments
'Salt Values' => array('model' => 'saltvalues_model', 'module' => 'saltvalues', 'relationships_model'=>'saltvaluecompositions/saltvaluecompositions_model') );
This is assuming that your saltvalues_model is in an advanced module folder (fuel/modules/saltvalues/models/saltvalues_model).
Also, is your saltvaluecompositions lookup table have the same columns as the fuel_relationships table.
i get error in the Drugs_base_controller.php on the _render function, error is
Fatal error: Call to a member function layout() on a non-object in C:\Program Files\Ampps\www\fuelcms\fuel\modules\drugs\libraries\Drugs_base_controller.php on line 32
i think, its not able to load the values from the config file, because when i pass values to $layout, it bypass it and throws error on
$uri_path = trim($this->fuel->drugs->config('uri'), '/');
what i am missing ?
function _render($view, $vars = array(), $return = FALSE, $layout='')
{
// on this line im getting error (Line 32), if pass default values to the layout, it bypass it and shows error on the next line
if (empty($layout)) $layout = $this->fuel->drugs->layout();
// get any global variables for the headers and footers
$uri_path = trim($this->fuel->drugs->config('uri'), '/');
$_vars = $this->fuel->pagevars->retrieve($uri_path);
if (is_array($_vars))
{
$vars = array_merge($_vars, $vars);
}
$view_folder = $this->fuel->drugs->theme_path();
$vars['CI'] =& get_instance();
$page = $this->fuel->pages->create();
if (!empty($layout))
{
$vars['body'] = $this->load->module_view($this->fuel->drugs->config('theme_module'), $view_folder.$view, $vars, TRUE);
$view = $this->fuel->drugs->theme_path().$this->fuel->drugs->layout();
}
else
{
$view = $view_folder.$view;
}
$vars = array_merge($vars, $this->load->get_vars());
$output = $this->load->module_view($this->fuel->drugs->config('theme_module'), $view, $vars, TRUE);
$output = $page->fuelify($output);
if ($return)
{
return $output;
}
else
{
$this->output->set_output($output);
}
}