Skip to content

Commit 4df5f72

Browse files
committed
Refactor: support new services layer.
1 parent 5be2bbb commit 4df5f72

File tree

21 files changed

+113
-111
lines changed

21 files changed

+113
-111
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22
php:
3-
- '7.3'
4-
- '7.4'
3+
- '8.0'
54

65
before_script:
76
- composer install

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 1.1.0 - 2021-04-21
8+
### Refactor
9+
- Support the new services layer.
10+
711
## 1.0.0 - 2021-01-09
812
### Added
913
- The initial implementation of the package.
1014

1115
# Versions
12-
- [1.0.0 > Unreleased](https://github.com/ulrack/orm-extension/compare/1.0.0...HEAD)
16+
- [1.1.0 > Unreleased](https://github.com/ulrack/orm-extension/compare/1.1.0...HEAD)
17+
- [1.0.0 > 1.1.0](https://github.com/ulrack/orm-extension/compare/1.0.0...1.1.0)

composer.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
"prefer-stable": true,
1212
"minimum-stability": "stable",
1313
"require": {
14-
"php": "^7.3",
15-
"grizz-it/configuration": "^1.2",
16-
"grizz-it/object-factory": "^1.1",
17-
"grizz-it/search": "^2.0",
18-
"grizz-it/storage": "^1.0",
19-
"ulrack/dbal": "^1.1",
20-
"ulrack/dbal-sql": "^4.0",
21-
"ulrack/invocation-extension": "^1.1",
22-
"ulrack/services": "^3.4"
14+
"php": "^8.0",
15+
"grizz-it/configuration": "^1.3",
16+
"grizz-it/dbal": "^1.0",
17+
"grizz-it/dbal-sql": "^1.0",
18+
"grizz-it/object-factory": "^1.2",
19+
"grizz-it/search": "^2.1",
20+
"grizz-it/services": "^1.0",
21+
"grizz-it/storage": "^1.1"
2322
},
2423
"authors": [
2524
{
@@ -57,7 +56,7 @@
5756
]
5857
},
5958
"require-dev": {
60-
"phpunit/phpunit": "^9.3",
61-
"squizlabs/php_codesniffer": "^3.5"
59+
"phpunit/phpunit": "^9.5",
60+
"squizlabs/php_codesniffer": "^3.6"
6261
}
6362
}

configuration/invocations/orm.invocations.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
{
2-
"orm.search.applicator": {
3-
"class": "\\Ulrack\\OrmExtension\\Component\\Applicator\\Applicator"
4-
},
5-
"orm.model.factory": {
6-
"class": "\\Ulrack\\OrmExtension\\Factory\\ModelFactory",
7-
"parameters": {
8-
"serviceFactory": "@{invocations.orm.get.service.factory}"
9-
}
10-
},
11-
"orm.collection.factory": {
12-
"class": "\\Ulrack\\OrmExtension\\Factory\\CollectionFactory",
13-
"parameters": {
14-
"modelFactory": "@{services.orm.model.factory}",
15-
"serviceFactory": "@{invocations.orm.get.service.factory}"
16-
}
17-
},
18-
"orm.abstract.data.source": {
19-
"abstract": true,
20-
"class": "\\Ulrack\\OrmExtension\\Component\\DataSource\\DatabaseDataSource",
21-
"parameters": {
22-
"applicator": "@{services.orm.search.applicator}"
23-
}
24-
},
25-
"orm.default.collection": {
26-
"class": "\\Ulrack\\OrmExtension\\Component\\Collection\\Collection",
27-
"parameters": {
28-
"modelGenerator": "@{template.modelGenerator}",
29-
"count": "@{template.count}"
2+
"services": {
3+
"orm.search.applicator": {
4+
"class": "\\Ulrack\\OrmExtension\\Component\\Applicator\\Applicator"
5+
},
6+
"orm.model.factory": {
7+
"class": "\\Ulrack\\OrmExtension\\Factory\\ModelFactory",
8+
"parameters": {
9+
"serviceFactory": "@{internal.core.service.factory}"
10+
}
11+
},
12+
"orm.collection.factory": {
13+
"class": "\\Ulrack\\OrmExtension\\Factory\\CollectionFactory",
14+
"parameters": {
15+
"modelFactory": "@{services.orm.model.factory}",
16+
"serviceFactory": "@{internal.core.service.factory}"
17+
}
18+
},
19+
"orm.abstract.data.source": {
20+
"abstract": true,
21+
"class": "\\Ulrack\\OrmExtension\\Component\\DataSource\\DatabaseDataSource",
22+
"parameters": {
23+
"applicator": "@{services.orm.search.applicator}"
24+
}
25+
},
26+
"orm.default.collection": {
27+
"class": "\\Ulrack\\OrmExtension\\Component\\Collection\\Collection",
28+
"parameters": {
29+
"modelGenerator": "@{template.modelGenerator}",
30+
"count": "@{template.count}"
31+
}
3032
}
3133
}
3234
}

docs/usage/databases-to-objects.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ through configuration. Create a service file in the `configurtion/services`
1919
directory for the data source and add the following content:
2020
```json
2121
{
22-
"data.source.books": {
23-
"parent": "orm.abstract.data.source",
24-
"parameters": {
25-
"connection": "@{database-connections.main}",
26-
"table": "book",
27-
"fields": [
28-
"id",
29-
"title",
30-
"author"
31-
]
22+
"services": {
23+
"data.source.books": {
24+
"parent": "orm.abstract.data.source",
25+
"parameters": {
26+
"connection": "@{database-connections.main}",
27+
"table": "book",
28+
"fields": [
29+
"id",
30+
"title",
31+
"author"
32+
]
33+
}
3234
}
3335
}
3436
}
@@ -47,10 +49,12 @@ an entry. First, create a service definition for the model for later use.
4749

4850
```json
4951
{
50-
"model.book": {
51-
"class": "\\MyVendor\\MyProject\\Model\\BookModel",
52-
"parameters": {
53-
"data": "@{template.data}"
52+
"services": {
53+
"model.book": {
54+
"class": "\\MyVendor\\MyProject\\Model\\BookModel",
55+
"parameters": {
56+
"data": "@{template.data}"
57+
}
5458
}
5559
}
5660
}
@@ -168,13 +172,15 @@ the application.
168172
Start, by adding the following service definition, to your services file:
169173
```json
170174
{
171-
"repository.books": {
175+
"services": {
176+
"repository.books": {
172177
"class": "\\MyVendor\\MyProject\\Repository\\BookRepository",
173-
"parameters": {
174-
"modelService": "services.model.book",
175-
"collectionService": "services.orm.default.collection",
176-
"collectionFactory": "@{services.orm.collection.factory}",
177-
"dataSource": "@{services.data.source.books}"
178+
"parameters": {
179+
"modelService": "services.model.book",
180+
"collectionService": "services.orm.default.collection",
181+
"collectionFactory": "@{services.orm.collection.factory}",
182+
"dataSource": "@{services.data.source.books}"
183+
}
178184
}
179185
}
180186
}

src/Common/Applicator/ApplicatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Ulrack\OrmExtension\Common\Applicator;
99

10-
use Ulrack\Dbal\Common\QueryInterface;
10+
use GrizzIt\Dbal\Common\QueryInterface;
1111
use GrizzIt\Search\Common\SearchCriteriaInterface;
1212

1313
interface ApplicatorInterface

src/Common/DataSource/DataSourceInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Ulrack\OrmExtension\Common\DataSource;
99

10-
use Ulrack\Dbal\Common\QueryResultInterface;
10+
use GrizzIt\Dbal\Common\QueryResultInterface;
1111
use GrizzIt\Search\Common\SearchCriteriaInterface;
1212

1313
interface DataSourceInterface
@@ -71,7 +71,7 @@ public function lastInsertId(): string;
7171
*
7272
* @return QueryResultInterface
7373
*/
74-
public function getByField(string $field, $value): QueryResultInterface;
74+
public function getByField(string $field, mixed $value): QueryResultInterface;
7575

7676
/**
7777
* Updates a data source based on a field.
@@ -84,7 +84,7 @@ public function getByField(string $field, $value): QueryResultInterface;
8484
*/
8585
public function updateByField(
8686
string $field,
87-
$value,
87+
mixed $value,
8888
array $data
8989
): QueryResultInterface;
9090

@@ -98,6 +98,6 @@ public function updateByField(
9898
*/
9999
public function deleteByField(
100100
string $field,
101-
$value
101+
mixed $value
102102
): QueryResultInterface;
103103
}

src/Common/Factory/CollectionFactoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Ulrack\OrmExtension\Common\Factory;
99

10-
use Ulrack\Dbal\Common\QueryResultInterface;
10+
use GrizzIt\Dbal\Common\QueryResultInterface;
1111
use Ulrack\OrmExtension\Common\Collection\CollectionInterface;
1212

1313
interface CollectionFactoryInterface

src/Component/Applicator/Applicator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77

88
namespace Ulrack\OrmExtension\Component\Applicator;
99

10-
use Ulrack\Dbal\Common\QueryInterface;
10+
use GrizzIt\Dbal\Common\QueryInterface;
1111
use GrizzIt\Search\Common\DirectionEnum;
1212
use GrizzIt\Search\Common\ComparatorEnum;
1313
use GrizzIt\Search\Common\FilterInterface;
14-
use Ulrack\Dbal\Common\Enum\SortDirectionEnum;
15-
use Ulrack\Dbal\Common\PageableQueryInterface;
16-
use Ulrack\Dbal\Common\SortableQueryInterface;
14+
use GrizzIt\Dbal\Common\Enum\SortDirectionEnum;
15+
use GrizzIt\Dbal\Common\PageableQueryInterface;
16+
use GrizzIt\Dbal\Common\SortableQueryInterface;
1717
use GrizzIt\Search\Common\FilterGroupInterface;
18-
use Ulrack\Dbal\Common\FilterableQueryInterface;
18+
use GrizzIt\Dbal\Common\FilterableQueryInterface;
1919
use GrizzIt\Search\Common\SearchCriteriaInterface;
20-
use Ulrack\Dbal\Sql\Component\Filter\ComparatorFilter;
21-
use Ulrack\Dbal\Sql\Component\Filter\QueryFilterGroup;
20+
use GrizzIt\Dbal\Sql\Component\Filter\ComparatorFilter;
21+
use GrizzIt\Dbal\Sql\Component\Filter\QueryFilterGroup;
2222
use Ulrack\OrmExtension\Common\Applicator\ApplicatorInterface;
23-
use Ulrack\Dbal\Sql\Common\ComparatorEnum as SqlComparatorEnum;
23+
use GrizzIt\Dbal\Sql\Common\ComparatorEnum as SqlComparatorEnum;
2424

2525
class Applicator implements ApplicatorInterface
2626
{

0 commit comments

Comments
 (0)