Example #1
0
 /**
  * @param string $uuid
  * @return \Apache\Usergrid\Response|bool
  * @throws \Apache\Usergrid\UGException
  */
 public function get_entity_by_uuid($uuid)
 {
     if (!Client::is_uuid($uuid)) {
         if ($this->client->are_exceptions_enabled()) {
             throw new UGException("Invalid UUID {$uuid}");
         }
         return FALSE;
     }
     $entity = new Entity($this->client, array('type' => $this->type, 'uuid' => $uuid));
     return $entity->fetch();
 }
Example #2
0
 public static function get_entity_id($entity)
 {
     $id = false;
     if (Client::is_uuid($entity->get('uuid'))) {
         $id = $entity->get('uuid');
     } else {
         if ($type == 'users') {
             $id = $entity->get('username');
         } else {
             if ($entity->get('name')) {
                 $id = $entity->get('name');
             }
         }
     }
     return $id;
 }