codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

missing primary key in has many relation

Open saleh199 opened this issue 11 years ago • 3 comments
trafficstars

when set $has_many variable and execute get_all method i got an error in line 493

public $has_many = array("family_member" => array("model" => "Form_family_model"));

So please edit documentation to this

public $has_many = array( 'comments' => array( 'model' => 'model_comments', 'primary_key' => 'post_id' ) );

Or add this code after line 484

$options["primary_key"] = $this->primary_key;

saleh199 avatar Jun 24 '14 13:06 saleh199

Thanks for this – could you send in a pull request making the change yourself? I'll happily merge it.

On 24 June 2014 14:34, Saleh Saiid [email protected] wrote:

when set $has_many variable and execute get_all method i got an error in line 493

public $has_many = array("family_member" => array("model" => "Form_family_model"));

So please edit documentation to this

public $has_many = array( 'comments' => array( 'model' => 'model_comments', 'primary_key' => 'post_id' ) );

Or add this code after line 484

$options["primary_key"] = $this->primary_key;

— Reply to this email directly or view it on GitHub https://github.com/jamierumbelow/codeigniter-base-model/issues/174.

Jamie Rumbelow [email protected]

jamierumbelow avatar Jun 24 '14 13:06 jamierumbelow

Please pull this request. It would have saved me 30 minutes. :)

rscotten avatar Oct 19 '16 20:10 rscotten

@rscotten It's already opened #175 @jamierumbelow

saleh199 avatar Oct 20 '16 07:10 saleh199