getId(), ($country !== null) ? $country->getId() : 0, ($state !== null) ? $state->getId() : 0 ); if (array_key_exists($key, self::$caches)) { return self::$caches[$key]; } $taxRuleQuery = TaxRuleCountryQuery::create() ->filterByTaxRuleId($taxRule->getId()); if (null !== $country) { $taxRuleQuery->filterByCountry($country, Criteria::EQUAL); } $synthetizedSateId = $state; if (null !== $state) { $taxRuleCount = clone $taxRuleQuery; if (0 === $taxRuleCount->filterByStateId($state->getId(), Criteria::EQUAL)->count()) { $synthetizedSateId = null; } } $taxRuleQuery->filterByStateId($synthetizedSateId, Criteria::EQUAL); $search = TaxQuery::create() ->filterByTaxRuleCountry($taxRuleQuery->find()) ->withColumn(TaxRuleCountryTableMap::COL_POSITION, self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION) ->orderBy(self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION, Criteria::ASC); ; return self::$caches[$key] = $search->find(); } } // TaxRuleQuery