I have an HAS_MANY relation called ‘_properties’ defined as:
'_properties'=> array(self::HAS_MANY,'EntityProperties', array('entity_property_id'=>'entity_property_id'),
'through'=>'entityPropertyLinks:active',
'index'=>'property_identifier',
),
I apply multiple conditions on this relation, each condition gets separate aliases.
$this->getDbCriteria()->mergeWith(
array(
'with'=>array(
'_properties'=>array(
'select'=>array(),
'alias'=>$relationAlias,
'condition'=>"$property_iden=\"$property\" AND $property_value $op $alias",
'together'=>'true',
'params'=>array($alias=>$value),
),
),
)
);
HOwever, the condition merging does not seem to work propery, only the “last” join survives the merging. The query below has the ‘eid18’ join that is missing, while the ‘eid20’ join is present
SELECT COUNT(DISTINCT `t`.`entity_id`) FROM `entity` `t` LEFT OUTER JOIN `devices` `device` ON (`device`.`entity_id`=`t`.`entity_id`) LEFT OUTER JOIN `entity_property_link` `epleid9` ON (`epleid9`.`entity_id`=`t`.`entity_id`) LEFT OUTER JOIN `entity_properties` `eid20` ON (`epleid9`.`entity_property_id`=`eid20`.`entity_property_id`) WHERE ((`t`.`type_id`=1 AND `t`.`is_active`=1) AND (`device`.`device_type_id`=:ycp1)) AND ((`eid18`.`property_identifier`="name" AND `eid18`.`property_value` LIKE :peid17) AND (`eid20`.`property_identifier`="firstname" AND `eid20`.`property_value` LIKE :peid19)). Bound with :ycp1='2', :peid17='%string1%', :peid19='%string2%'
Does the team confirm this as a bug?
Can this be fixed?