loadFromUniqueKey (   $key,
  $value 
)

Retrieves and loads an object from a unique key.

Devuelve
IcesDBObject The initialized instance of IcesDBObject with $key = $value, or FALSE.

Hace referencia a $cache.

247  {
248  if (!isset(IcesSerializer::$cache[$this->classname])) {
249  $cache[$this->classname] = array();
250  }
251  if (!isset(IcesSerializer::$cache[$this->classname][$key])) {
252  $cache[$this->classname][$key] = array();
253  }
254  if (!isset(IcesSerializer::$cache[$this->classname][$key][$value])) {
255  $query = db_select($this->table, 't')->fields('t')->condition($key, $value)->range(0, 1);
256  $result = $query->execute();
257  $record = $result->fetchAssoc();
258  if ($record === FALSE) {
259  return FALSE;
260  }
261  IcesSerializer::$cache[$this->classname][$key][$value] = $this->loadFromRecord($record);
262  }
263  return IcesSerializer::$cache[$this->classname][$key][$value];
264  }
static $cache
cache array.
Definition: common.db.logic.inc:27
loadFromRecord($record)
Loads a IcesDBObject from it record.
Definition: common.db.logic.inc:80