diff --git a/src/DataStructures/QueryResponseRow.php b/src/DataStructures/QueryResponseRow.php deleted file mode 100644 index 5cee746..0000000 --- a/src/DataStructures/QueryResponseRow.php +++ /dev/null @@ -1,30 +0,0 @@ -Search = null; - $this->Results = null; - return; - } - $this->Search = key(array: $array); - foreach($array["{$this->Search}"] as $key=>$value) - { - $this->Results[] = new KeyValuePair(key: $key, value: $value); - } - } - - public function __toString(): string - { - return json_encode($this, JSON_PRETTY_PRINT); - } - -} \ No newline at end of file diff --git a/src/DataStructures/QueryResponseWrapper.php b/src/DataStructures/QueryResponseWrapper.php deleted file mode 100644 index c9797c4..0000000 --- a/src/DataStructures/QueryResponseWrapper.php +++ /dev/null @@ -1,36 +0,0 @@ -Rows[] = QueryResponseRow::FromArray(array: $row); - $builder->RowFormat = $temp["@row_format"]; - - return $builder; - } - - public function Flatten(): array - { - $builder = []; - - foreach($this->Rows as $row) - { - foreach($row->Results as $result) - { - $builder[] = $result; - } - } - - return $builder; - } -} diff --git a/src/QueryBuilder/SelectQuery/SelectQueryResponse.php b/src/QueryBuilder/SelectQuery/SelectQueryResponse.php index 7b4271c..689bdb8 100644 --- a/src/QueryBuilder/SelectQuery/SelectQueryResponse.php +++ b/src/QueryBuilder/SelectQuery/SelectQueryResponse.php @@ -2,8 +2,6 @@ namespace Darksparrow\DeegraphInteractions\QueryBuilder\SelectQuery; -use Darksparrow\DeegraphInteractions\DataStructures\QueryResponseRow; - final class SelectQueryResponse { public array $Rows; @@ -11,8 +9,10 @@ final class SelectQueryResponse public function __construct(array $response) { + // var_dump($response); + foreach($response["@rows"] as $row) - $this->Rows[] = new QueryResponseRow(array: $row); + $this->Rows[] = new SelectQueryResponseRow(array: $row); $this->RowFormat = $response["@row_format"]; } } \ No newline at end of file diff --git a/src/QueryBuilder/SelectQuery/SelectQueryResponseRow.php b/src/QueryBuilder/SelectQuery/SelectQueryResponseRow.php new file mode 100644 index 0000000..57ab09f --- /dev/null +++ b/src/QueryBuilder/SelectQuery/SelectQueryResponseRow.php @@ -0,0 +1,27 @@ +$data) + { + foreach($data as $key => $value) { + $this->Properties[$property][$key] = $value; + } + } + } + + public function __toString(): string + { + return json_encode($this, JSON_PRETTY_PRINT); + } +}