diff --git a/src/Connection/Connection.php b/src/Connection/Connection.php index a867c72..8e2f90d 100644 --- a/src/Connection/Connection.php +++ b/src/Connection/Connection.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Connection/ConnectionInterface.php b/src/Connection/ConnectionInterface.php index 65f3c9d..ed3aca2 100644 --- a/src/Connection/ConnectionInterface.php +++ b/src/Connection/ConnectionInterface.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/DB.php b/src/DB.php index a8b39bd..8a96daa 100644 --- a/src/DB.php +++ b/src/DB.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ @@ -136,10 +136,9 @@ public function __call($name, $arguments) throw new DatabaseException('The "' . $name . '" method does not exist.'); } - public function with(): self + public function newInstance(): self { - $with = clone $this; - return $with; + return new self($this->configurations); } /** @@ -162,7 +161,8 @@ public function setSchema(string $schema): self public function withSchema(string $schema): self { - return $this->with()->setSchema($schema); + $with = clone $this; + return $with->setSchema($schema); } /** @@ -185,7 +185,8 @@ public function setSchemaID(string $schemaID): self public function withSchemaID(string $schemaID): self { - return $this->with()->setSchemaID($schemaID); + $with = clone $this; + return $with->setSchemaID($schemaID); } public function isError(): bool diff --git a/src/DataMapper/DataMapper.php b/src/DataMapper/DataMapper.php index 8caf682..2fbe629 100644 --- a/src/DataMapper/DataMapper.php +++ b/src/DataMapper/DataMapper.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/DataMapper/DataMapperInterface.php b/src/DataMapper/DataMapperInterface.php index bb5d749..7e6d140 100644 --- a/src/DataMapper/DataMapperInterface.php +++ b/src/DataMapper/DataMapperInterface.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Entity.php b/src/Entity.php index 088385e..720f58f 100644 --- a/src/Entity.php +++ b/src/Entity.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/DataMapperException.php b/src/Exceptions/DataMapperException.php index 031e30c..9d11d28 100644 --- a/src/Exceptions/DataMapperException.php +++ b/src/Exceptions/DataMapperException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/DataMapperInvalidArgumentException.php b/src/Exceptions/DataMapperInvalidArgumentException.php index cca28ef..d340294 100644 --- a/src/Exceptions/DataMapperInvalidArgumentException.php +++ b/src/Exceptions/DataMapperInvalidArgumentException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/DatabaseConnectionException.php b/src/Exceptions/DatabaseConnectionException.php index 233399e..9a61900 100644 --- a/src/Exceptions/DatabaseConnectionException.php +++ b/src/Exceptions/DatabaseConnectionException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/DatabaseException.php b/src/Exceptions/DatabaseException.php index 983db39..6664a7a 100644 --- a/src/Exceptions/DatabaseException.php +++ b/src/Exceptions/DatabaseException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/DatabaseInvalidArgumentException.php b/src/Exceptions/DatabaseInvalidArgumentException.php index bd70229..5bd5e75 100644 --- a/src/Exceptions/DatabaseInvalidArgumentException.php +++ b/src/Exceptions/DatabaseInvalidArgumentException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/ModelCallbacksException.php b/src/Exceptions/ModelCallbacksException.php index 92433cd..c48f577 100644 --- a/src/Exceptions/ModelCallbacksException.php +++ b/src/Exceptions/ModelCallbacksException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/ModelException.php b/src/Exceptions/ModelException.php index 0e8f4ff..6a40e5d 100644 --- a/src/Exceptions/ModelException.php +++ b/src/Exceptions/ModelException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/ModelPermissionException.php b/src/Exceptions/ModelPermissionException.php index 2684f37..9b7d526 100644 --- a/src/Exceptions/ModelPermissionException.php +++ b/src/Exceptions/ModelPermissionException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/ModelRelationsException.php b/src/Exceptions/ModelRelationsException.php index 48e07c9..1d9aac0 100644 --- a/src/Exceptions/ModelRelationsException.php +++ b/src/Exceptions/ModelRelationsException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/QueryBuilderException.php b/src/Exceptions/QueryBuilderException.php index 1d1a718..5f67ecd 100644 --- a/src/Exceptions/QueryBuilderException.php +++ b/src/Exceptions/QueryBuilderException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/QueryBuilderInvalidArgumentException.php b/src/Exceptions/QueryBuilderInvalidArgumentException.php index 04ace69..3b37b33 100644 --- a/src/Exceptions/QueryBuilderInvalidArgumentException.php +++ b/src/Exceptions/QueryBuilderInvalidArgumentException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Exceptions/ValidationException.php b/src/Exceptions/ValidationException.php index 4f37d46..e690c17 100644 --- a/src/Exceptions/ValidationException.php +++ b/src/Exceptions/ValidationException.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Helper.php b/src/Helper.php index 8505c8d..7e5107b 100644 --- a/src/Helper.php +++ b/src/Helper.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Model.php b/src/Model.php index fe5309a..8d48984 100644 --- a/src/Model.php +++ b/src/Model.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/From.php b/src/QueryBuilder/Expressions/From.php index e282b57..f021b88 100644 --- a/src/QueryBuilder/Expressions/From.php +++ b/src/QueryBuilder/Expressions/From.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/GroupBy.php b/src/QueryBuilder/Expressions/GroupBy.php index 80c3426..b5872b3 100644 --- a/src/QueryBuilder/Expressions/GroupBy.php +++ b/src/QueryBuilder/Expressions/GroupBy.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/Join.php b/src/QueryBuilder/Expressions/Join.php index 2af73cb..87356ae 100644 --- a/src/QueryBuilder/Expressions/Join.php +++ b/src/QueryBuilder/Expressions/Join.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/Limit.php b/src/QueryBuilder/Expressions/Limit.php index f94c334..bb665d1 100644 --- a/src/QueryBuilder/Expressions/Limit.php +++ b/src/QueryBuilder/Expressions/Limit.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/OrderBy.php b/src/QueryBuilder/Expressions/OrderBy.php index 06030b1..82350d0 100644 --- a/src/QueryBuilder/Expressions/OrderBy.php +++ b/src/QueryBuilder/Expressions/OrderBy.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/Select.php b/src/QueryBuilder/Expressions/Select.php index 903db73..1cacc06 100644 --- a/src/QueryBuilder/Expressions/Select.php +++ b/src/QueryBuilder/Expressions/Select.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/Expressions/WhereAndHaving.php b/src/QueryBuilder/Expressions/WhereAndHaving.php index 04b5cd3..266126a 100644 --- a/src/QueryBuilder/Expressions/WhereAndHaving.php +++ b/src/QueryBuilder/Expressions/WhereAndHaving.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/QueryBuilder.php b/src/QueryBuilder/QueryBuilder.php index b1704a6..fa93d84 100644 --- a/src/QueryBuilder/QueryBuilder.php +++ b/src/QueryBuilder/QueryBuilder.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/QueryBuilder/QueryBuilderInterface.php b/src/QueryBuilder/QueryBuilderInterface.php index 92fc28f..7d33cc1 100644 --- a/src/QueryBuilder/QueryBuilderInterface.php +++ b/src/QueryBuilder/QueryBuilderInterface.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index de0c695..d0b4363 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ diff --git a/src/Validation/ValidationRulesTrait.php b/src/Validation/ValidationRulesTrait.php index 9dc0287..735488a 100644 --- a/src/Validation/ValidationRulesTrait.php +++ b/src/Validation/ValidationRulesTrait.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */ @@ -26,7 +26,7 @@ protected function is_unique($data, $column, $schemaID = null): bool if($this->db->getSchemaID() === null){ throw new ValidationException('You need a model with a PRIMARY KEY to use the is_unique validation.'); } - $db = $this->db->with(); + $db = $this->db->newInstance(); $db->getQueryBuilder()->reset(); $db->getDataMapper()->getParameters(); // Prev parameters reset. @@ -46,6 +46,7 @@ protected function required($data): bool { if(!\is_iterable($data) && !\is_object($data)){ $data = \trim((string)$data); + return $data !== ''; } return !empty($data); } diff --git a/src/init.php b/src/init.php index d450174..efc6dca 100644 --- a/src/init.php +++ b/src/init.php @@ -7,7 +7,7 @@ * @author Muhammet ŞAFAK * @copyright Copyright © 2022 Muhammet ŞAFAK * @license ./LICENSE MIT - * @version 1.1.12 + * @version 1.1.13 * @link https://www.muhammetsafak.com.tr */