/** * Returns the real object. * * @return object */ public function getObject() { if ($this->thawedObject === NULL) { $this->thawedObject = $this->storage->fetch($this->uuid); } return $this->thawedObject; }
/** * Constructor. * * @param string $database * Name of the database to be used * @param Object_Freezer $freezer * Object_Freezer instance to be used * @param Object_Freezer_Cache $cache * Object_Freezer_Cache instance to be used * @param boolean $useLazyLoad * Flag that controls whether objects are * fetched using lazy load or not * @param string $host * Hostname of the CouchDB instance to be used * @param int $port * Port of the CouchDB instance to be used * @throws InvalidArgumentException */ public function __construct($database, Object_Freezer $freezer = NULL, Object_Freezer_Cache $cache = NULL, $useLazyLoad = FALSE, $host = 'localhost', $port = 5984) { parent::__construct($freezer, $cache, $useLazyLoad); // Bail out if a non-string was passed. if (!is_string($database)) { throw Object_Freezer_Util::getInvalidArgumentException(1, 'string'); } // Bail out if a non-string was passed. if (!is_string($host)) { throw Object_Freezer_Util::getInvalidArgumentException(4, 'string'); } // Bail out if a non-integer was passed. if (!is_int($port)) { throw Object_Freezer_Util::getInvalidArgumentException(5, 'integer'); } $this->database = $database; $this->host = $host; $this->port = $port; }