function addTireSize(VF_TireSize $tireSize) { $select = $this->getReadAdapter()->select()->from('elite_vehicle_tire')->where('leaf_id = ?', (int) $this->wrappedVehicle->getLeafValue())->where('section_width = ?', (int) $tireSize->sectionWidth())->where('aspect_ratio = ?', (int) $tireSize->aspectRatio())->where('diameter = ?', (int) $tireSize->diameter()); $result = $select->query(); if ($result->fetchColumn()) { return; } $this->getReadAdapter()->insert('elite_vehicle_tire', array('leaf_id' => (int) $this->wrappedVehicle->getLeafValue(), 'section_width' => $tireSize->sectionWidth(), 'aspect_ratio' => $tireSize->aspectRatio(), 'diameter' => $tireSize->diameter())); }
function productIds(VF_TireSize $tireSize, $tireType = null) { $select = $this->getReadAdapter()->select()->from('elite_product_tire', 'distinct(entity_id) entity_id')->where('section_width = ?', $tireSize->sectionWidth())->where('aspect_ratio = ?', $tireSize->aspectRatio())->where('diameter = ?', $tireSize->diameter()); if (!is_null($tireType)) { $select->where('tire_type = ?', $tireType); } $result = $select->query(); $return = array(); while ($row = $result->fetch()) { array_push($return, $row['entity_id']); } return $return; }
function testAspectRatio() { $tireSize = new VF_TireSize(null, 55, null); $this->assertEquals(55, $tireSize->aspectRatio(), 'tire size has an aspect ratio'); }