function findById($id) { $identityMap = VF_Vehicle_Finder_IdentityMap::getInstance(); if ($identityMap->has($id)) { return $identityMap->get($id); } $select = $this->getReadAdapter()->select() ->from('elite_' . $this->schema->id() . '_definition', $this->getColumns()); $this->addJoins($select, false); $select->where('elite_' . $this->schema->id() . '_definition.id = ?', $id); $r = $this->query($select); if (!$r) { throw new Exception(mysql_error()); } $row = $r->fetchObject(); if (!is_object($row)) { throw new Exception('No such definition with id [' . $id . ']'); } $vehicle = new VF_Vehicle($this->schema, $id, $row); $identityMap->add($vehicle); return $vehicle; }
function resetIdentityMaps() { VF_Vehicle_Finder_IdentityMap::reset(); VF_Vehicle_Finder_IdentityMapByLevel::reset(); VF_Level_IdentityMap::reset(); VF_Level_IdentityMap_ByTitle::reset(); VF_Schema::reset(); VF_Vehicle_Finder::$IDENTITY_MAP_FINDBYLEVEL = array(); }