Hi Toopay, another bug I think.
After applying the patches I have this error:
ERROR: column tbl_sample_related_context.tbl_sample_sample_refid does not exist LINE 1: SELECT * FROM "tbl_sample_related_context" WHERE "tbl_sample... ^
SELECT * FROM "tbl_sample_related_context" WHERE "tbl_sample_related_context"."tbl_sample_sample_refid" IN (2)
Filename: /var/ci/application/third_party/gas/classes/core.php
Line Number: 839
In the Where clause after the period it wrongly puts the table name connected to the primary key, it uses ‘tbl_sample_sample_refid’ when it should only be ‘sample_refid’.
The relationships appear set up properly as are the primary/foreign key values in both models.
Calling Line:
$data['sample'] = Model\Tbl_sample::where("site_code = '".$site_code."' AND sample_number = ".$sample_number)->with('related')->all();
Also same error with ->get(1) instead of ->all().
Tbl_sample exert:
class Tbl_sample extends ORM {
public $primary_key = 'sample_refid';
function _init()
{
self::$relationships = array (
'monolith' => ORM::has_one('\\Model\\Tbl_sample_monolith'),
'processed' => ORM::has_one('\\Model\\Tbl_processing'),
'series' => ORM::has_one('\\Model\\Tbl_sample_series'),
'children' => ORM::has_many('\\Model\\Tbl_parent_sample'),
'location' => ORM::has_many('\\Model\\Tbl_sample\\Tbl_sample_location'),
'purpose' => ORM::has_many('\\Model\\Tbl_sample_secondary_purpose'),
'related' => ORM::has_many('\\Model\\Tbl_sample_related_context'),
);
Tbl_sample_related_context exert:
class Tbl_sample_related_context extends ORM {
public $primary_key = 'sample_context_refid';
public $foreign_key = array('\\Model\\Tbl_sample' => 'sample_refid');
function _init()
{
self::$relationships = array(
'sample' => ORM::belongs_to('\\Model\\Tbl_sample'),
);