/** * Get internal identifier of an object, using its UUID. * * @param string $uuid * * @return int|string * Internal identifier. For objects that are awaiting for integer, don't * forget to cast NULL in case of failure. */ public static function getIdentifierByUuid($uuid) { if ($uuid_data = yamm_api_uuid_load($uuid)) { return $uuid_data->identifier; } throw new Yamm_Entity_UnknownUuidException("UUID " . $uuid . " does not exists in database."); }
/** * Differed constructor. This method is being called at instanciation time. * * @param string $uuid * * @return Yamm_Entity * Any class subclassing Yamm_Entity. */ public function _setUuid($uuid) { $this->__uuid = $uuid; $uuid_data = yamm_api_uuid_load($uuid); $this->__identifier = $uuid_data->identifier; if ($parser) { $this->__parser = $parser; } if (!($object = $this->_objectLoad($this->__identifier))) { throw new Yamm_Entity_UnableToLoadObjectException("Return object is null for type " . $this->_type . " and identifier " . $this->__identifier . "."); } $this->__object = $object; $this->_constructDependencies($this->__object); $this->__hookConstruct(); }