/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param CampusBuilding $value A CampusBuilding object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(CampusBuilding $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
<?php error_reporting(E_ALL); include_once "../../config/ProjectConfiguration.class.php"; $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); $sfContext = sfContext::createInstance($configuration); $sfContext->dispatch(); $dom = new DOMDocument(); $dom->loadXML(file_get_contents("buildings.kml")); $xpath = new DOMXPath($dom); $query = '//Placemark'; $entries = $xpath->query($query); echo "\n\n\n"; foreach ($entries as $en) { $children = $en->childNodes; $add = new CampusBuilding(); foreach ($children as $cn) { $nodeName = $cn->localName; if ($nodeName == "name") { $add->setName($cn->textContent); echo $cn->textContent . "\n"; } if ($nodeName == "ExtendedData") { $extendedChildren = $cn->childNodes; foreach ($extendedChildren as $ex) { switch ($ex->localName) { case "CenterLat": $add->setLatitude($ex->textContent); break; case "CenterLng": $add->setLongitude($ex->textContent);