Skip to content

Commit

Permalink
Merge pull request #3 from fykosak/dev-0.2.1
Browse files Browse the repository at this point in the history
Dev 0.2.1
  • Loading branch information
cevro authored Mar 25, 2021
2 parents 99642b2 + 76ad9f1 commit 19571cd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/tests/config.local.neon
/tests/temp/*
!/tests/temp/.gitignore
coverage.html
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Nette ORM

![GitHub branch checks state](https://img.shields.io/github/checks-status/fykosak/nette-orm/master)
<img src="https://img.shields.io/badge/coverage-87%25-green" />
<img src="https://img.shields.io/badge/coverage-97%25-green" />

## install

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "fykosak/nette-orm",
"type": "library",
"license": "GPL-3.0-or-later",
"version": "0.2.0",
"version": "0.2.1",
"require": {
"php": ">=7.4",
"nette/di": "^3.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 1 addition & 36 deletions src/AbstractService.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,6 @@ 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->explorer->getConventions();
}

/** @return string|AbstractModel */
final public function getModelClassName(): string {
return $this->modelClassName;
Expand All @@ -153,25 +137,6 @@ protected function checkType(AbstractModel $model): void {
}
}

/**
* Default data for the new model.
* TODO is this really needed?
* @return array
*/
protected function getDefaultData(): array {
if (!isset($this->defaults)) {
$this->defaults = [];
foreach ($this->getColumnMetadata() as $column) {
if ($column['nativetype'] == 'TIMESTAMP' && isset($column['default'])
&& !preg_match('/^[0-9]{4}/', $column['default'])) {
continue;
}
$this->defaults[$column['name']] = isset($column['default']) ? $column['default'] : null;
}
}
return $this->defaults;
}

/**
* Omits array elements whose keys aren't columns in the table.
*
Expand All @@ -189,7 +154,7 @@ protected function filterData(array $data): array {
return $result;
}

private function getColumnMetadata(): array {
protected function getColumnMetadata(): array {
if (!isset($this->columns)) {
$this->columns = $this->explorer->getConnection()->getDriver()->getColumns($this->tableName);
}
Expand Down

0 comments on commit 19571cd

Please sign in to comment.