Skip to content

Commit 291f7b7

Browse files
chore: release 3.0.0 (#306)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Martin Georgiev <martin-georgiev@users.noreply.github.com>
1 parent 90a9b9e commit 291f7b7

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.10.3"
2+
".": "3.0.0"
33
}

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# Changelog
22

3+
## [3.0.0](https://github.com/martin-georgiev/postgresql-for-doctrine/compare/v2.10.3...v3.0.0) (2025-03-30)
4+
5+
6+
### ⚠️🚨 BREAKING CHANGES
7+
8+
_For detailed upgrade guide read here: [UPGRADE.md](docs/UPGRADE.md)_
9+
10+
#### 1. Type Preservation for PostgreSQL numerical and text arrays
11+
12+
The library now attempts to strictly preserve the type of values when converting between PostgreSQL arrays and PHP arrays. This affects all array type handlers including `TextArray`, integer arrays, and boolean arrays.
13+
14+
**What changed:** Previously, numeric values could lose their type information during conversion (e.g., floats might become integers, string representations of numbers might become actual numbers). With version 3.0.0, the original data types are preserved in both directions. The change comes from PR [#304](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/304).
15+
16+
**Examples:**
17+
- Integer values like `1` remain integers
18+
- Float values like `1.5` remain floats
19+
- String representations like `'1'` remain strings
20+
- Boolean values like `true`/`false` remain booleans
21+
- Scientific notation like `'1.23e5'` is preserved
22+
23+
#### 2. Refactored Exception Handling for JsonbArray
24+
25+
The exception handling for `JsonbArray` has been refactored to be more consistent with the network types approach, providing clearer error messages and better diagnostics.
26+
27+
**What changed:** Previously, generic exceptions were thrown when JSON array conversion failed. With version 3.0.0, specific `InvalidJsonbArrayItemForPHPException` is used with more descriptive error messages about the exact nature of the failure. The change comes from PR [#311](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/311).
28+
29+
### Features
30+
31+
#### Added new data types
32+
* Add support for array of float types `real[]` and `double precision[]` ([#307](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/307)) ([1db35ac](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/1db35ac6f73b12e2691ca35fc6c63b0b8a3c4b28))
33+
* Add support for network types `inet`, `inet[]`, `cidr`, `cidr[]`, `macaddr`, `macaddr[]` ([#310](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/310)) ([ba3f9f2](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/ba3f9f2833fc68f4e36ae7202396794fc43ecb63))
34+
35+
#### Added new functions
36+
* Add support for `any_value()` ([#323](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/323)) ([19ee3db](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/19ee3dbd4497195bbcd3b4df7608232de0f32b8a))
37+
* Add support for `array_shuffle()` ([#324](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/324)) ([90a9b9e](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/90a9b9e84f8ec9a0dc9fd81b2d80ae48b59f2e57))
38+
* Add support for `xmlagg()` ([#318](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/318)) ([0b4db8a](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/0b4db8a930964b9292e7d6f79678dbc76b9d841a))
39+
40+
#### Extended support in some existing functions
41+
* Add support for `NULL` value in `array_append()`, `array_replace()`, `array_prepend()`, `array_remove()` ([#322](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/322)) ([396856f](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/396856f81c40b2eefed801995c1fced455e8a8dd))
42+
* Add support for `DISTINCT` and `ORDER BY` clauses to `json_agg()` and `jsonb_agg()` ([#317](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/317)) ([4cdc638](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/4cdc638841b23449daa9d9c0a5f9e53e15724fa3))
43+
* Add support for `DISTINCT` clause to `array_agg()` ([#316](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/316)) ([3c46021](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/3c4602109754b345277e292e86ffd03200d91fa8))
44+
45+
### Code Refactoring
46+
* Modernise the validation in active code and the associated tests when dealing with integer arrays ([#308](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/308)) ([67c344e](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/67c344e11e16529049422b9fe9024310594a0392))
47+
348
## [2.10.3](https://github.com/martin-georgiev/postgresql-for-doctrine/compare/v2.10.2...v2.10.3) (2025-03-24)
449

550

docs/UPGRADE.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Upgrade Instructions
2+
3+
## How to Upgrade to Version 3.0.0
4+
5+
### 1. Review type handling in your code
6+
If your application relies on automatic type conversion between PostgreSQL and PHP (e.g., expecting string numbers to be converted to actual numbers or vice versa), you'll need to update your code to explicitly handle type conversion where needed.
7+
8+
```php
9+
// Before: Might convert '1.0' to integer 1
10+
$tags = $entity- >getTags(); // ['1.0', '2.5']
11+
$numericValue = $tags[0] + 2; // Would work even if string
12+
13+
// After: Preserves '1.0' as string
14+
$tags = $entity->getTags(); // ['1.0', '2.5']
15+
$numericValue = (float)$tags[0] + 2; // Explicit conversion needed
16+
```
17+
18+
### 2. Update your code to handle exceptions
19+
If you're catching specific exception types when working with `JsonbArray`, update your exception handling to catch the new `InvalidJsonbArrayItemForPHPException`.
20+
21+
```php
22+
// Before
23+
try {
24+
$jsonArray = $jsonbArrayType->convertToPHPValue($postgresValue, $platform);
25+
} catch (\MartinGeorgiev\Doctrine\DBAL\Types\Exceptions\TypeException $e) {
26+
// Handle exception
27+
}
28+
29+
// After
30+
try {
31+
$jsonArray = $jsonbArrayType->convertToPHPValue($postgresValue, $platform);
32+
} catch (\MartinGeorgiev\Doctrine\DBAL\Types\Exceptions\InvalidJsonbArrayItemForPHPException $e) {
33+
// Handle exception
34+
}
35+
```
36+
37+
### 3. Test thoroughly
38+
Since these changes affect data type handling at a fundamental level, thoroughly test all database interactions, especially those involving array types, to ensure your application handles the preserved types correctly.
39+

0 commit comments

Comments
 (0)