public static function prepareSingleItem($data_item, $convert_type)
 {
     $collection_item = new BackendlessCollection($data_item);
     switch ($convert_type) {
         case "std_class":
             return $collection_item->convertToStdClasses();
         case "user_class":
             return $collection_item->convertToUserClasses();
         case "array":
             return $collection_item->convertToArray();
     }
 }
Beispiel #2
0
 public function update($data)
 {
     $data_array = $this->convertDataToArray($data);
     if (!isset($data_array['data']['objectId'])) {
         throw new BackendlessException('Missing objectId property value for update');
     }
     $this->cheackTargetTable($data_array['table'], __METHOD__);
     // if call method of() check target table and  table in data structure
     $this->unsetTableName();
     //delete table name if user call mehod of()
     return BackendlessCollection::prepareSingleItem(RequestBuilder::doRequest('data', $data_array['table'] . '/' . $data_array['data']['objectId'], $data_array['data'], 'PUT'), $data_array["type"]);
 }