⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Relation n bug?



Fanil
  • profile picture
  • Member

Posted 06 October 2016 - 16:08 PM

Hi everybody!

 

im have problem:

$crud = new grocery_CRUD();
$crud 
->where('survey_oy.region_id', $p1)
->set_table('survey_oy')
->set_subject('subject')
//this work correct
->set_relation('region_id', 'survey_region', 'region_name')


//but if this uncomment i have error. because ?('survey_oy' == 'survey_oy')
//->set_relation('oy_parent_id', 'survey_oy', 'name_oy') 
;
;
$crud->render();

ERROR

Unknown column 'survey_oy.name_oy' in 'field list'


SELECT dml_survey_oy.*, j0f442f96.region_name AS s0f442f96, ja45a2255.name_oy AS sa45a2255, 
`survey_oy`.name_oy AS 'survey_oy.name_oy' FROM `dml_survey_oy` LEFT JOIN `dml_survey_region` as 
`j0f442f96` ON `j0f442f96`.`id` = `dml_survey_oy`.`region_id` LEFT JOIN `dml_survey_oy` as `ja45a2255` 
ON `ja45a2255`.`id` = `dml_survey_oy`.`oy_parent_id` WHERE `dml_survey_oy`.`region_id` = '1' LIMIT 30

column exist

CREATE TABLE IF NOT EXISTS `dml_survey_oy` (
  `id` int(9) unsigned NOT NULL AUTO_INCREMENT,
  `region_id` int(10) DEFAULT NULL,
  `type_oy` int(10) DEFAULT NULL,
  `oy_active` tinyint(1) NOT NULL DEFAULT '1',
  `name_oy` varchar(500) DEFAULT NULL,
  `oy_parent_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=197 ;

my issue here but im not understund how fix it

//Grocery_crud_model.php

if ($this->field_exists($related_field_title))
    $select .= ", `{$this->table_name}`.$related_field_title AS '{$this->table_name}.$related_field_title'";

help!