docs: Doctrine section with Doctrine Behaviors and Doctrine Helper (uk + en)
en/docs/doctrine/doctrine-helper/README.md
new file +52
โ0
1
+
# Doctrine Helper
2
+
3
+
:::block class="package-card"
4
+
<include>(docs/doctrine/doctrine-helper/.info.md)
5
+
:::
6
+
7
+
A set of ready-made traits, interfaces and classes for Doctrine that take the routine out of describing entities: primary keys (auto-increment, UUID, `uniqid`) and PHP enums as the MySQL `ENUM` type.
8
+
9
+
It is a plain library, not a Symfony bundle: it registers nothing in the container and has no configuration of its own. Traits are added to an entity with `use`; the enum type is registered in the Doctrine DBAL settings.
10
+
11
+
## What is inside
12
+
13
+
| Class | Purpose |
14
+
|-------|---------|
15
+
| `Ufo\DoctrineHelper\Traits\AutoIncrementIdTrait` | Auto-increment integer `id` |
16
+
| `Ufo\DoctrineHelper\Traits\UuidIdTrait` | `id` is a UUID v7 generated in code |
17
+
| `Ufo\DoctrineHelper\Traits\UniqueIdTrait` | `id` is a 13-character `uniqid()` string |
18
+
| `Ufo\DoctrineHelper\Traits\UniqueUuidIdTrait` | Deprecated, use `UuidIdTrait` instead |
19
+
| `Ufo\DoctrineHelper\Interfaces\IHaveUniqueUuid` | Contract of an entity with a string `id` |
20
+
| `Ufo\DoctrineHelper\Interfaces\IHaveAutoincrementId` | Contract of an entity with an integer `id` |
21
+
| `Ufo\DoctrineHelper\Utils\Uuid` | Generates UUID v7 and deterministic UUID v3 |
22
+
| `Ufo\DoctrineHelper\DBAL\AbstractEnumType` | Base DBAL type for a PHP backed enum โ `ENUM(...)` |
23
+
24
+
## Example
25
+
26
+
```php
27
+
use Doctrine\ORM\Mapping as ORM;
28
+
use Ufo\DoctrineHelper\Interfaces\IHaveUniqueUuid;
29
+
use Ufo\DoctrineHelper\Traits\UuidIdTrait;
30
+
31
+
#[ORM\Entity]
32
+
class Order implements IHaveUniqueUuid
33
+
{
34
+
use UuidIdTrait; // #[ORM\Id], string(36), unique, getId(): string
35
+
36
+
public function __construct()
37
+
{
38
+
$this->generateUniqueId(); // UUID v7
39
+
}
40
+
}
41
+
```
42
+
43
+
## Sections
44
+
45
+
* [Entity identifiers](/docs/doctrine/doctrine-helper/entity_ids) โ primary key traits, interfaces, `Uuid`.
46
+
* [PHP enum as ENUM](/docs/doctrine/doctrine-helper/enum_type) โ `AbstractEnumType`, type registration, limitations.
47
+
* [Changelog](/docs/doctrine/doctrine-helper/change_log)
48
+
* [Known issues](/docs/doctrine/doctrine-helper/known_issues/open)
49
+
50
+
:::info
51
+
This documentation describes version 1.1.0 (2025-06-09). The `doctrine/orm` and `doctrine/dbal` dependencies are declared in `composer.json` only since 1.1.0; before that the library required only `ramsey/uuid`.
52
+
:::
en/docs/doctrine/doctrine-helper/.info.md
new file +18
โ0
1
+
[](/docs/doctrine/doctrine-helper/change_log)
2
+
[](https://packagist.org/packages/ufo-tech/doctrine-helper/stats)
3
+
[](https://github.com/UFO-Tech/DoctrineHelper)
4
+
5
+
```bash
6
+
composer require ufo-tech/doctrine-helper
7
+
```
8
+
9
+
* **PHP** 8.3+
10
+
* **Built on** Doctrine ORM 2.12+ ยท 3, DBAL 3.2+ ยท 4
11
+
* **Type** PHP library
12
+
* **Category** Doctrine
13
+
* **License** MIT
14
+
15
+
[GitHub](https://github.com/UFO-Tech/DoctrineHelper)
16
+
[Packagist](https://packagist.org/packages/ufo-tech/doctrine-helper)
17
+
[Changelog](/docs/doctrine/doctrine-helper/change_log)
18
+
[Known issues](/docs/doctrine/doctrine-helper/known_issues/open)