[eluser]smi23[/eluser]
Hello again!
I think I've found another bug, but co-workers says that it shouldn't.
Function include_related_count().
Code:
$customers = new Clinic_customer();
$customers->include_related('clinic',array('name'))->include_related_count('clinic_customer_journal')
->where_related('clinic','deleted',0)->get_paged(1,10);
It returns an error with Unknown column 'clinic_customers_subquery.id':
Code:
SELECT `ci_clinic_customers`.*, `clinics`.`name` AS clinic_name,
(SELECT COUNT(*) AS count FROM (`ci_clinic_customer_journals`) LEFT OUTER JOIN `ci_clinic_customers` clinic_customers
ON `clinic_customers_subquery`.`id` = `ci_clinic_customer_journals`.`clinic_customer_id`
WHERE `clinic_customers_subquery`.id = `clinic_customers`.`id`) AS clinic_customer_journal_count
FROM ....
And I found in function
_parse_subquery_object() // line 3054, that it replace
clinic_customers.id with
clinic_customer_subquery.id , but the alias for table
ci_clinic_customer it leaves without changing (
clinic_customers).
Models should be fine (I worked with them a lot).
Please, help me to resolve this.