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();
 }
Exemple #2
0
 function testPrefixingZero2()
 {
     $identityMap = new VF_Level_IdentityMap_ByTitle();
     $identityMap->add(1, 'make', '01');
     $this->assertFalse($identityMap->get('make', '1'));
 }
    function delete()
    {
        if (!(int) $this->getId())
        {
            throw new Exception();
        }

        $identityMap = VF_Level_IdentityMap_ByTitle::getInstance();
        $identityMap->remove($this->getType(), $this->getId());

        $this->deleteFits();

        $this->deleteChildren();

        $query = sprintf("DELETE FROM `" . $this->getTable() . "` WHERE   `id` = %d", $this->getId());
        $this->query($query);

        $query = sprintf("DELETE FROM `" . $this->getSchema()->definitionTable() . "` WHERE `" . $this->getType() . "_id` = %d", $this->getId());
        $this->query($query);

        if ($this->getType() == $this->getSchema()->getLeafLevel() && file_exists(ELITE_PATH . '/Vafwheel'))
        {
            $query = sprintf("DELETE FROM `elite_definition_wheel` WHERE `leaf_id` = %d", $this->getId());
            $this->query($query);
        }
    }
Exemple #4
0
 /** @return integer ID */
 function findEntityIdByTitle($type, $title, $parent_id = 0)
 {
     $identityMap = VF_Level_IdentityMap_ByTitle::getInstance();
     if ($identityMap->has($type, $title)) {
         return $identityMap->get($type, $title);
     }
     $inflectedType = $this->inflect($type);
     $query = $this->getReadAdapter()->select()->from(array('l' => 'elite_level_' . $this->getSchema()->id() . '_' . $inflectedType))->where('`title` LIKE binary ?', $title);
     $result = $this->query($query);
     $id = $result->fetchColumn(0);
     if (!$id) {
         return false;
     }
     $identityMap->add($id, $type, $title);
     return $id;
 }