diff --git a/src/Common/EntityResolver.php b/src/Common/EntityResolver.php index 95e90f9..04f93c8 100644 --- a/src/Common/EntityResolver.php +++ b/src/Common/EntityResolver.php @@ -170,9 +170,9 @@ class EntityResolver { return $table; } - public function databaseName() : string + public function databaseName() : ? string { - return $this->tableAnnotation(false)->database ?? $this->databaseAdapter()->adapter()->database; + return $this->tableAnnotation(false)->database ?? $this->databaseAdapter()->adapter()->database ?? null; } public function sqlAdapter() : \Ulmus\ConnectionAdapter diff --git a/src/ConnectionAdapter.php b/src/ConnectionAdapter.php index 2964efe..97d37f5 100644 --- a/src/ConnectionAdapter.php +++ b/src/ConnectionAdapter.php @@ -41,7 +41,7 @@ class ConnectionAdapter public function getConfiguration() : array { - return $this->configuration['connections'][$this->name]; + return $this->configuration['connections'][$this->name] ?? []; } /** diff --git a/src/Query/Set.php b/src/Query/Set.php index a3ddce4..b97e023 100644 --- a/src/Query/Set.php +++ b/src/Query/Set.php @@ -27,7 +27,7 @@ class Set extends Fragment { return $this; } - public function render() : string + public function render() /* : mixed */ { return $this->renderSegments([ 'SET', $this->renderParameterPlaceholders(), diff --git a/src/Query/Where.php b/src/Query/Where.php index 72e7b17..851ec1d 100644 --- a/src/Query/Where.php +++ b/src/Query/Where.php @@ -114,7 +114,7 @@ class Where extends Fragment { } # whitelisting operators - return in_array(strtoupper($this->operator), [ '=', '!=', '<>', 'LIKE' ]) ? $this->operator : "="; + return in_array(strtoupper($this->operator), [ '=', '!=', '<>', 'LIKE', 'IS', 'IS NOT' ]) ? $this->operator : "="; } protected function value() diff --git a/src/Repository.php b/src/Repository.php index 8ce8bc6..9f1f97d 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -161,6 +161,7 @@ class Repository $entity->entityFillFromDataset($dataset); + return $update ? (bool) $update->rowCount() : false; } } @@ -612,7 +613,7 @@ class Repository return Ulmus::datasetQueryBuilder($this->queryBuilder, $this->adapter); } - public function runQuery() : ? \PDOStatement + public function runQuery() /* : mixed */ { $this->finalizeQuery();