function insertMappings(VF_Wheel_BoltPattern $boltPattern) { if ($boltPattern->getOffset()) { $q = sprintf("\n SELECT DISTINCT(`leaf_id`) as leaf_id\n FROM `elite_definition_wheel`\n WHERE `bolt_distance` = %s\n AND `lug_count` = %d\n AND `offset` >= %s\n AND `offset` <= %s\n ", (double) $boltPattern->getDistance(), (double) $boltPattern->getLugCount(), (double) $boltPattern->offsetMin(), (double) $boltPattern->offsetMax()); } else { $q = sprintf("\n SELECT DISTINCT(`leaf_id`) as leaf_id\n FROM `elite_definition_wheel`\n WHERE `bolt_distance` = %s\n AND `lug_count` = %d\n ", (double) $boltPattern->getDistance(), (double) $boltPattern->getLugCount()); } $result = $this->query($q); $years = array(); $rows = $result->fetchAll(Zend_Db::FETCH_OBJ); foreach ($rows as $row) { $vehicle = $this->definition($row->leaf_id); $this->insertMapping($vehicle); } }
function setWheelSideBoltPattern(VF_Wheel_BoltPattern $boltPattern) { $sql = sprintf("REPLACE INTO `elite_product_wheeladapter` ( `entity_id`, `lug_count`, `bolt_distance` ) VALUES ( %d, %d, %s )", $this->getId(), (int) $boltPattern->getLugCount(), (double) $boltPattern->getDistance()); $this->query($sql); }