Open issues in Doctrine Helper

← Open issues in Doctrine Helper

Ashterix

docs: Doctrine section with Doctrine Behaviors and Doctrine Helper (uk + en)

en/docs/doctrine/doctrine-helper/known_issues/open.md new file +13 āˆ’0

1 + # Open issues in Doctrine Helper
2 +
3 + Known bugs and inconsistencies of the current version of `ufo-tech/doctrine-helper` (1.1.0). Fixed ones are on the [Fixed issues](/docs/doctrine/doctrine-helper/known_issues/fixed) page.
4 +
5 + <include>(.issues/autoincrement-interface-mismatch.md)
6 +
7 + ---
8 +
9 + <include>(.issues/enum-null-value.md)
10 +
11 + ---
12 +
13 + <include>(.issues/readme-errors.md)

en/docs/doctrine/doctrine-helper/known_issues/.issues/autoincrement-interface-mismatch.md new file +29 āˆ’0

1 + ### AutoIncrementIdTrait is incompatible with IHaveAutoincrementId
2 +
3 + :::warning subtitle="Open"
4 + Affected versions: 1.0.0 — 1.1.0 (current). Verified by running on PHP 8.4.
5 + :::
6 +
7 + **Symptom.** A class that implements `IHaveAutoincrementId` and uses `AutoIncrementIdTrait` does not load:
8 +
9 + ```text
10 + Fatal error: Declaration of App\Entity\Customer::getId(): ?int must be compatible with
11 + Ufo\DoctrineHelper\Interfaces\IHaveAutoincrementId::getId(): int
12 + ```
13 +
14 + **Cause.** `AutoIncrementIdTrait::getId()` returns `?int` (there is no identifier before `flush()`), while the interface requires `int`.
15 +
16 + **Workaround.** Do not implement the interface, or override the method in the class — a class method takes precedence over a trait method:
17 +
18 + ```php
19 + #[ORM\Entity]
20 + class Customer implements IHaveAutoincrementId
21 + {
22 + use AutoIncrementIdTrait;
23 +
24 + public function getId(): int
25 + {
26 + return $this->id ?? throw new \LogicException('Customer is not persisted yet.');
27 + }
28 + }
29 + ```

en/docs/doctrine/doctrine-helper/known_issues/.issues/enum-null-value.md new file +11 āˆ’0

1 + ### AbstractEnumType does not accept null
2 +
3 + :::warning subtitle="Open"
4 + Affected versions: 1.0.0 — 1.1.0 (current). Verified by running on PHP 8.4 with DBAL 3.10; DBAL 4 passes `null` to the type in the same way.
5 + :::
6 +
7 + **Symptom.** Writing `null` to a column with an `AbstractEnumType`-based type, even with `nullable: true`, fails with `InvalidArgumentException: Invalid 'App\MyEnum' value.` (on PHP 8.1+ preceded by the deprecation `Passing null to parameter #1 ($value)`).
8 +
9 + **Cause.** DBAL calls `convertToDatabaseValue()` for `null` too, and the method passes the value to `$enum::from()` without a check; any error is turned into `InvalidArgumentException`. The `string|int` return type does not allow fixing this by overriding the method in a subclass.
10 +
11 + **Workaround.** For nullable fields use Doctrine ORM's built-in enum mapping instead of this type — `#[ORM\Column(type: 'string', enumType: MyEnum::class, nullable: true)]` (the column is then `VARCHAR`, not `ENUM`) — or a dedicated enum case for a missing value.

en/docs/doctrine/doctrine-helper/known_issues/.issues/readme-errors.md new file +12 āˆ’0

1 + ### Errors in the package README
2 +
3 + :::warning subtitle="Open"
4 + Affected versions: 1.0.0 — 1.1.0 (current). Verified against `README.md` and `composer.json` of tag 1.1.0.
5 + :::
6 +
7 + * In the entity example `changeCase()` writes to the non-existent `$this->type` property instead of `$this->case`.
8 + * The `MyEnumType` example lacks `use Ufo\DoctrineHelper\DBAL\AbstractEnumType;`.
9 + * The README describes only `AbstractEnumType`; the traits, interfaces and `Uuid` are not mentioned.
10 + * The `homepage` link in `composer.json` and "Documentations" in the README point to `docs.ufo-tech.space`, not to this site.
11 +
12 + Correct examples are on the [PHP enum as ENUM](/docs/doctrine/doctrine-helper/enum_type) and [Entity identifiers](/docs/doctrine/doctrine-helper/entity_ids) pages.