There's an example in the docs where a relationship is defined without using the fuel_relationships table
here and I think there is a closing bracket missing in the code?
public $has_many = array('attributes' => array('model' => array(FUEL_FOLDER => 'fuel_tags_model'), 'fuel_relationships_model' => 'my_relationship_model', 'foreign_key' => 'my_foreign_key', 'candidate_key' => 'candidate_key');
I'm trying to create a has_many relationship using the ion_auth models, so I would like the look-up table to be "users_groups", the candidate table to be "users" and the foreign table to be "groups". I've got the has_many property close to being correct, but the example above is throwing me.
I want something like:
$has_many = array('groups' => array('model' => array('app' => 'groups_model')), 'fuel_relationships_model' => 'users_groups_model'...
but I am running into problems defining the foreign_key and candidate_key - should the models be stated as well with these?
Comments
MY_Model::relationship_field_names() method is where that mapping happens. If the fuel_relationships model lives in an advanced module folder (e.g. not the application directory), then you will need to use an array syntax with the key being the module and the value being the model. Also, the user_groups_model should inherit from MY_Model.