function vafUrl(Elite_Vaf_Model_Vehicle $vehicle) { $params = http_build_query($vehicle->toValueArray()); if ($vehicle->getLeafValue()) { if ('/' == $this->getRequest()->getBasePath()) { return '/vaf/product/list?' . $params; } return $this->getRequest()->getBasePath() . '/vaf/product/list?' . $params; } return '?' . $params; }
function getMappingId(Elite_Vaf_Model_Vehicle $vehicle) { $schema = new Elite_Vaf_Model_Schema(); $select = $this->getReadAdapter()->select()->from('elite_mapping', 'id')->where($schema->getLeafLevel() . '_id = ?', $vehicle->getLeafValue())->where('entity_id = ?', $this->getId()); return $select->query()->fetchColumn(); }
/** * @var integer entity_id of the product row * @var Elite_Vaf_Model_Vehicle to check for assocation with * @return boolean true only if the mapping between the product+definition exists */ function hasMapping($entity_id, Elite_Vaf_Model_Vehicle $vehicle) { $sql = sprintf("SELECT count(*) FROM elite_mapping WHERE entity_id = %d AND %s = %d LIMIT 1", (int) $entity_id, $this->getReadAdapter()->quoteIdentifier($this->getSchema()->getLeafLevel() . '_id'), (int) $vehicle->getLeafValue()); $r = $this->query($sql); return (bool) 0 != $r->fetchColumn(); }