PHPackages                             eboreum/caster-doctrine-entity-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. eboreum/caster-doctrine-entity-formatter

ActiveLibrary[Database &amp; ORM](/categories/database)

eboreum/caster-doctrine-entity-formatter
========================================

A caster formatter for Doctrine entities (see doctrine/orm), specifically.

1.0.0(3y ago)0242MITPHPPHP ^8.1

Since Jun 24Pushed 3y ago2 watchersCompare

[ Source](https://github.com/eboreum/caster-doctrine-entity-formatter)[ Packagist](https://packagist.org/packages/eboreum/caster-doctrine-entity-formatter)[ RSS](/packages/eboreum-caster-doctrine-entity-formatter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

eboreum/caster-doctrine-entity-formatter
========================================

[](#eboreumcaster-doctrine-entity-formatter)

[![license](https://camo.githubusercontent.com/d13878988daeb5aa91b9a5c3c54c5405cc836b03e4c39cb8e4317d0884115767/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f65626f7265756d2f6361737465722d646f637472696e652d656e746974792d666f726d61747465723f6c6162656c3d6c6963656e7365)](https://camo.githubusercontent.com/d13878988daeb5aa91b9a5c3c54c5405cc836b03e4c39cb8e4317d0884115767/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f65626f7265756d2f6361737465722d646f637472696e652d656e746974792d666f726d61747465723f6c6162656c3d6c6963656e7365)[![build](https://github.com/eboreum/caster-doctrine-entity-formatter/workflows/build/badge.svg?branch=main)](https://github.com/eboreum/caster-doctrine-entity-formatter/actions)[![Code Coverage](https://camo.githubusercontent.com/5857b1bc2770a716b9eade40f8b31734142ea989255069b3aecc7b55f44274d2/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6b61666f736f2f65396361383734646263343064323961646438303164393461633739613636332f7261772f746573742d636f7665726167655f5f6d61696e2e6a736f6e)](https://github.com/eboreum/caster-doctrine-entity-formatter/actions)[![PHPStan Level](https://camo.githubusercontent.com/aba0e8d79104a60b61c85250a79a846a2b519eb42791ff324b519850d5352808/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6b61666f736f2f65396361383734646263343064323961646438303164393461633739613636332f7261772f7068707374616e2d6c6576656c5f5f6d61696e2e6a736f6e)](https://github.com/eboreum/caster-doctrine-entity-formatter/actions)

A caster formatter for Doctrine entities (see [doctrine/orm](https://packagist.org/packages/doctrine/orm)), specifically.

---

Requirements
============

[](#requirements)

```
"php": "^8.1",
"ext-mbstring": "*",
"doctrine/annotations": "^1.0",
"doctrine/orm": "^2.0",
"eboreum/caster": "^1.0",
"eboreum/exceptional": "^1.0"
```

For more information, see the [`composer.json`](composer.json) file.

Installation
============

[](#installation)

Via [Composer](https://getcomposer.org/) ():

```
composer require eboreum/caster-doctrine-entity-formatter

```

Via GitHub:

```
git clone git@github.com:eboreum/caster-doctrine-entity-formatter.git

```

Fundamentals
============

[](#fundamentals)

This library is a bridge between [eboreum/caster](https://packagist.org/packages/eboreum/caster) and [doctrine/orm](https://packagist.org/packages/doctrine/orm).

This library handles formatting of entity classes, which either:

- Has the attribute `Doctrine\ORM\Mapping\Entity` (commonly written as `#[ORM\Entity]`).
- Has the annotation `Doctrine\ORM\Mapping\Entity` (commonly written as `@ORM\Entity` in the docblock of a class).

ID properties (i.e. `Doctrine\ORM\Mapping\Id` or `@ORM\Id` as either attribute or annotation) are always identified and included. May be used with `Eboreum\Caster\Contract\DebugIdentifierAttributeInterface` and subsequently the attribute `Eboreum\Caster\Attribute\DebugIdentifier`, to provide additional information about the entity. The latter is especially useful in the following scenarios (often during debugging):

- The entity has not yet been persisted and thus it has not yet received an ID (e.g. through auto generation). By having `#[DebugIdentifier]` on other properties, this may help providing crucial debugging information.
- Some other, non-ID property is essential for e.g. debugging purposes.
- Some desire to increase verbosity on an entity when it is being formatted.

For help with Doctrine annotations and/or attributes and their uses, please see:

- Attributes reference:
- Annotations reference:

Examples
========

[](#examples)

Basics
------

[](#basics)

**Code:**

```
