/**
  * Create an object or return existing one.
  *
  * <code>
  * $locationId = 1;
  *
  * $location   = Socialcommunity\Location\Location::getInstance(\JFactory::getDbo(), $locationId);
  * </code>
  *
  * @param \JDatabaseDriver $db
  * @param array            $keys
  *
  * @return null|Location
  */
 public static function getInstance(\JDatabaseDriver $db, $keys)
 {
     $id = !array_key_exists('id', $keys) ? 0 : (int) $keys['id'];
     if (!array_key_exists($id, self::$instances) and $id > 0) {
         $item = new Location($db);
         $item->load($keys);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
 /**
  * Create a location object and return it.
  *
  * <code>
  * $options = array(
  *     "ids" => array(1,2,3,4,5)
  * );
  * 
  * $locations   = new Socialcommunity\Locations(JFactory::getDbo());
  * $locations->load($options);
  *
  * $location = $locations->getLocation(1);
  * </code>
  *
  * @param string $id
  *
  * @return null|Location
  */
 public function getLocation($id)
 {
     $location = null;
     if (array_key_exists($id, $this->items)) {
         $location = new Location($this->db);
         $location->bind($this->items[$id]);
     }
     return $location;
 }