From 9ebf7b05d76d9575b003a77d412b25eddeb3f8f2 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Tue, 29 Aug 2023 20:29:33 +0000 Subject: [PATCH] - Bugfixes made while working on lean/console --- src/Adapter/AdapterInterface.php | 1 + src/Adapter/MsSQL.php | 7 ++++++- src/Adapter/MySQL.php | 5 +++++ src/Adapter/SQLite.php | 5 +++++ src/EntityCollection.php | 6 ++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Adapter/AdapterInterface.php b/src/Adapter/AdapterInterface.php index 5694ef7..6d3ee2c 100644 --- a/src/Adapter/AdapterInterface.php +++ b/src/Adapter/AdapterInterface.php @@ -30,4 +30,5 @@ interface AdapterInterface { public function tableSyntax() : array; public function whitelistAttributes(array &$parameters) : void; public function generateAlterColumn(FieldDefinition $definition, array $field) : string|\Stringable; + public function splitAlterQuery() : bool; } diff --git a/src/Adapter/MsSQL.php b/src/Adapter/MsSQL.php index bd6e130..311605d 100644 --- a/src/Adapter/MsSQL.php +++ b/src/Adapter/MsSQL.php @@ -229,7 +229,7 @@ class MsSQL implements AdapterInterface { return Ulmus::convertObject($value); case is_array($value): - return json_encode($array); + return json_encode($value); case is_bool($value): return (int) $value; @@ -252,4 +252,9 @@ class MsSQL implements AdapterInterface { { return QueryBuilder\MssqlQueryBuilder::class; } + + public function splitAlterQuery() : bool + { + return false; + } } diff --git a/src/Adapter/MySQL.php b/src/Adapter/MySQL.php index b5cc47a..50179d5 100644 --- a/src/Adapter/MySQL.php +++ b/src/Adapter/MySQL.php @@ -175,4 +175,9 @@ class MySQL implements AdapterInterface { { return "InnoDB"; } + + public function splitAlterQuery() : bool + { + return false; + } } diff --git a/src/Adapter/SQLite.php b/src/Adapter/SQLite.php index 03f354e..05464dd 100644 --- a/src/Adapter/SQLite.php +++ b/src/Adapter/SQLite.php @@ -213,4 +213,9 @@ class SQLite implements AdapterInterface { $definition->getSqlParams(), ]); } + + public function splitAlterQuery() : bool + { + return true; + } } diff --git a/src/EntityCollection.php b/src/EntityCollection.php index 152ebd5..b664fee 100644 --- a/src/EntityCollection.php +++ b/src/EntityCollection.php @@ -222,6 +222,12 @@ class EntityCollection extends \ArrayObject implements \JsonSerializable { return $list; } + + public function walk(Callable $callback) : self + { + return $this->filtersCollection($callback); + } + public function sum($field) : float|int { return array_sum($this->column($field));