diff --git a/thor/Database/PdoExtension/PdoRequester.php b/thor/Database/PdoExtension/PdoRequester.php index 8530995..fa1fd57 100644 --- a/thor/Database/PdoExtension/PdoRequester.php +++ b/thor/Database/PdoExtension/PdoRequester.php @@ -104,7 +104,7 @@ final public function getPdoHandler(): PdoHandler return $this->handler; } - static function in(array $elements) : string + public static function in(array $elements) : string { return '(' . implode(',', array_fill(0, count($elements), '?')) . ')'; } diff --git a/thor/Database/PdoTable/TableType/JsonType.php b/thor/Database/PdoTable/TableType/JsonType.php new file mode 100644 index 0000000..cb74cfe --- /dev/null +++ b/thor/Database/PdoTable/TableType/JsonType.php @@ -0,0 +1,47 @@ +associative); + } + + /** + * @param mixed $phpValue + * + * @return string + */ + public function toSqlValue(mixed $phpValue): string + { + return json_encode($phpValue); + } +}