From 7b9fdc739b033f3161a311c5144ea21801687da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mi=C5=A1o=20=C4=8Cerve=C5=88=C3=A1k?= Date: Wed, 24 Mar 2021 23:06:11 +0100 Subject: [PATCH] Make explorer and conventions pulic --- composer.json | 11 ++++++++++- composer.lock | 17 +++++++++-------- src/AbstractService.php | 16 +++++++++++----- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index adadda1..e51a4c0 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,9 @@ { + "description": "", "name": "fykosak/nette-orm", "type": "library", "license": "GPL-3.0-or-later", - "version": "0.1.2", + "version": "0.1.3", "require": { "php": ">=7.4", "nette/di": "^3.0.8", @@ -10,9 +11,17 @@ "ext-pdo": "*" }, "authors": [ + { + "name": "Michal Koutny", + "email": "michal@fykos.cz" + }, { "name": "Michal Mišo Červeňák", "email": "miso@fykos.cz" + }, + { + "name": "Lukáš Timo", + "email": "lukast@fykos.cz" } ], "autoload": { diff --git a/composer.lock b/composer.lock index 71d8d11..d5c1468 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "a3506e975c8876e7bfb8f62b166eea51", + "content-hash": "78d84f024bba4e6b80abe56c253a257a", "packages": [ { "name": "nette/caching", @@ -75,22 +75,22 @@ }, { "name": "nette/database", - "version": "v3.1.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/nette/database.git", - "reference": "94caf0bf9b24d63f0ca7d0201ee47a9bcfcfa7d2" + "reference": "17bc9b2b5a5cd57ab089bc1a5982bc6c3b3790e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/database/zipball/94caf0bf9b24d63f0ca7d0201ee47a9bcfcfa7d2", - "reference": "94caf0bf9b24d63f0ca7d0201ee47a9bcfcfa7d2", + "url": "https://api.github.com/repos/nette/database/zipball/17bc9b2b5a5cd57ab089bc1a5982bc6c3b3790e3", + "reference": "17bc9b2b5a5cd57ab089bc1a5982bc6c3b3790e3", "shasum": "" }, "require": { "ext-pdo": "*", "nette/caching": "^3.0", - "nette/utils": "^3.1", + "nette/utils": "^3.2.1", "php": ">=7.2 <8.1" }, "conflict": { @@ -144,7 +144,7 @@ "queries", "sqlite" ], - "time": "2020-12-21T01:23:36+00:00" + "time": "2021-01-12T12:24:12+00:00" }, { "name": "nette/di", @@ -615,7 +615,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.4" + "php": ">=7.4", + "ext-pdo": "*" }, "platform-dev": [] } diff --git a/src/AbstractService.php b/src/AbstractService.php index a5751b1..401918d 100644 --- a/src/AbstractService.php +++ b/src/AbstractService.php @@ -23,15 +23,13 @@ abstract class AbstractService { protected ?array $defaults = null; private string $modelClassName; private string $tableName; - private Explorer $explorer; - private Conventions $conventions; + public Explorer $explorer; private array $columns; - public function __construct(string $tableName, string $modelClassName, Explorer $explorer, Conventions $conventions) { + public final function __construct(string $tableName, string $modelClassName, Explorer $explorer) { $this->tableName = $tableName; $this->modelClassName = $modelClassName; $this->explorer = $explorer; - $this->conventions = $conventions; } /** @@ -123,12 +121,20 @@ public function store(?AbstractModel $model, array $data): AbstractModel { } } + /** + * @return Explorer + * @deprecated + */ public function getExplorer(): Explorer { return $this->explorer; } + /** + * @return Conventions + * @deprecated + */ public function getConventions(): Conventions { - return $this->conventions; + return $this->explorer->getConventions(); } /** @return string|AbstractModel */