Esempio n. 1
0
 protected function update($parameters)
 {
     list($fields, $values) = $this->parseParameters($parameters);
     $fields = \Bolt\Arrays::removeElement("id", $fields);
     $setString = $this->getQuerySetString($fields);
     $SQL = "UPDATE `" . $this->table . "`\n\t\t\t\t\tSET " . $setString . "\n\t\t\t\t\tWHERE `id` = :id";
     return $this->dbo->query($SQL, $values);
 }
Esempio n. 2
0
 private function handleObject($content)
 {
     $type = \Bolt\Arrays::type($content);
     if ($type == "numeric") {
         $results = array();
         foreach ($content as $tmp) {
             if (\Bolt\Arrays::type($tmp) !== false || get_class($tmp) == "stdClass") {
                 $results = $content;
             } else {
                 $results[] = json_decode($tmp->toJson());
             }
         }
         return json_encode($results);
     } elseif ($type != "assoc" && get_class($content) != "stdClass") {
         return $content->toJson();
     } else {
         return json_encode($content);
     }
 }
Esempio n. 3
0
 private function createNode($array, $node)
 {
     foreach ($array as $key => $value) {
         $key = str_replace(" ", "_", $key);
         if (is_scalar($value)) {
             $value = !is_string($value) ? var_export($value, true) : $value;
             $element = $this->dom->createElement($key, $value);
             $node->appendChild($element);
         } elseif (is_array($value)) {
             if (\Bolt\Arrays::type($value) == "numeric") {
                 $element = $this->dom->createElement($key);
                 foreach ($value as $next) {
                     if (is_scalar($next)) {
                         $next = !is_string($next) ? var_export($next, true) : $next;
                         $inner = $this->dom->createElement("value", $next);
                         $element->appendChild($inner);
                     } else {
                         $inner = $this->dom->createElement($next->className(false));
                         $inner = $this->createNode($next, $inner);
                         $element->appendChild($inner);
                     }
                 }
                 $node->appendChild($element);
             } else {
                 $element = $this->dom->createElement($key);
                 $element = $this->createNode($value, $element);
                 $node->appendChild($element);
             }
         } elseif (is_object($value)) {
             $element = $this->dom->createElement($key);
             $element = $this->createNode($value, $element);
             $node->appendChild($element);
         }
     }
     return $node;
 }