Download the PHP package eboreum/caster-doctrine-entity-formatter without Composer
On this page you can find all versions of the php package eboreum/caster-doctrine-entity-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eboreum/caster-doctrine-entity-formatter
More information about eboreum/caster-doctrine-entity-formatter
Files in eboreum/caster-doctrine-entity-formatter
Package caster-doctrine-entity-formatter
Short Description A caster formatter for Doctrine entities (see doctrine/orm), specifically.
License MIT
Informations about the package caster-doctrine-entity-formatter
eboreum/caster-doctrine-entity-formatter
A caster formatter for Doctrine entities (see doctrine/orm), specifically.
Requirements
For more information, see the composer.json
file.
Installation
Via Composer (https://packagist.org/packages/eboreum/caster-doctrine-entity-formatter):
composer require eboreum/caster-doctrine-entity-formatter
Via GitHub:
git clone [email protected]:eboreum/caster-doctrine-entity-formatter.git
Fundamentals
This library is a bridge between eboreum/caster and 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: https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/reference/attributes-reference.html
- Annotations reference: https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/reference/annotations-reference.html#annotations-reference
Examples
Basics
Code:
Output:
Render DebugIdentifier
only when ID is not set
The wording "is not set" means the ID can be either uninitialized or null
.
Why?
Often, when you have an ID of something, other information may end up just creating noise. This feature allows you to reduce such noise.
Code:
Output:
License & Disclaimer
See LICENSE
file. Basically: Use this library at your own risk.
Contributing
We prefer that you create a ticket and/or a pull request at https://github.com/eboreum/caster-doctrine-entity-formatter, and have a discussion about a feature or bug here.
Credits
Authors
- Kasper Søfren (kafoso)
E-mail: https://github.com/kafoso - Carsten Jørgensen (corex)
E-mail: https://github.com/corex
All versions of caster-doctrine-entity-formatter with dependencies
ext-mbstring Version *
doctrine/annotations Version ^1.0
doctrine/orm Version ^2.0
eboreum/caster Version ^1.0
eboreum/exceptional Version ^1.0