Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow php 8.3 #388

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Release"
uses: "laminas/automatic-releases@v1"
Expand Down
7 changes: 7 additions & 0 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"exclude": [
{
"name": "Infection on PHP 8.1 with locked dependencies"
}
]
}
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DoctrineBatchUtils

This repository attempts to ease the pain of dealing with
This repository attempts to ease the pain of dealing with
[batch-processing](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/batch-processing.html)
in the context of [Doctrine ORM](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/)
transactions.
Expand All @@ -21,15 +21,14 @@ composer require ocramius/doctrine-batch-utils

## Current features

As it stands, the only implemented utility in this repository is an
[`IteratorAggregate`](http://php.net/manual/en/class.iteratoraggregate.php) that
wraps around a DB transaction and calls
As it stands, the only implemented utility in this repository is an
[`IteratorAggregate`](http://php.net/manual/en/class.iteratoraggregate.php) that
wraps around a DB transaction and calls
[`ObjectManager#flush()`](https://github.com/doctrine/common/blob/v2.5.1/lib/Doctrine/Common/Persistence/ObjectManager.php#L120)
and [`ObjectManager#clear()`](https://github.com/doctrine/common/blob/v2.5.1/lib/Doctrine/Common/Persistence/ObjectManager.php#L88)
on the given [`EntityManager`](https://github.com/doctrine/doctrine2/blob/v2.5.1/lib/Doctrine/ORM/EntityManagerInterface.php).


#### Example (array iteration)
### Example (array iteration)

It can be used as following:

Expand All @@ -50,18 +49,18 @@ foreach ($iterable as $record) {
}
```

##### `$record` freshness
#### `$record` freshness

Please note that the `$record` inside the loop will always be "fresh"
Please note that the `$record` inside the loop will always be "fresh"
([`managed`](http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#persisting-entities) state),
as the iterator re-fetches it on its own: this prevents you from having to
manually call [`ObjectManager#find()`](https://github.com/doctrine/common/blob/v2.5.1/lib/Doctrine/Common/Persistence/ObjectManager.php#L42)
on your own for every iteration.

##### Automatic flushing/clearing
#### Automatic flushing/clearing

In this example, the `EntityManager` will be flushed and cleared only once,
but if there were more than 100 records, then it would flush (and clear) twice
In this example, the `EntityManager` will be flushed and cleared only once,
but if there were more than 100 records, then it would flush (and clear) twice
or more.

#### Example (query/iterators)
Expand All @@ -86,7 +85,6 @@ foreach ($iterable as $record) {

Or our own iterator/generator:


```php
use DoctrineBatchUtils\BatchProcessing\SimpleBatchIteratorAggregate;

Expand Down
5 changes: 2 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.0.0

**BC Breaks**
### BC Breaks

Access to the actual entity has changed. In previous versions the entity could be accessed via `[0]` on result item like this:

Expand All @@ -15,7 +15,7 @@ foreach ($iterable as $record) {
```

That was rather confusing and unexpected so it is no longer wrapped in array and `[0]` acessor must be dropped:

```php
foreach ($iterable as $record) {
$entity = $record;
Expand All @@ -29,4 +29,3 @@ foreach ($iterable as $record) {
- The return type of `DoctrineBatchUtils\BatchProcessing\Exception\MissingBatchItemException::fromInvalidReference()` changed from no type to `DoctrineBatchUtils\BatchProcessing\Exception\MissingBatchItemException`
- The parameter `$object` of `DoctrineBatchUtils\BatchProcessing\Exception\MissingBatchItemException::fromInvalidReference()` changed from no type to a non-contravariant object
- The parameter `$object` of `DoctrineBatchUtils\BatchProcessing\Exception\MissingBatchItemException::fromInvalidReference()` changed from no type to object

14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"doctrine/orm": "^2.14.3",
"doctrine/persistence": "^3.1.4"
},
"require-dev": {
"doctrine/coding-standard": "^11.1.0",
"roave/infection-static-analysis-plugin": "^1.30.0",
"phpunit/phpunit": "^9.6.7",
"vimeo/psalm": "^5.9.0",
"doctrine/annotations" : "^1.14.3",
"doctrine/dbal" : "^3.6.2"
"doctrine/coding-standard": "^12.0.0",
"roave/infection-static-analysis-plugin": "^1.33",
"phpunit/phpunit": "^10.4.2",
"vimeo/psalm": "^5.15",
"doctrine/annotations" : "^2.0.1",
"doctrine/dbal" : "^3.7.1"
},
"autoload": {
"psr-4": {
Expand Down
Loading
Loading