Download the PHP package cyril-verloop/doctrine-entities without Composer
On this page you can find all versions of the php package cyril-verloop/doctrine-entities. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cyril-verloop/doctrine-entities
More information about cyril-verloop/doctrine-entities
Files in cyril-verloop/doctrine-entities
Package doctrine-entities
Short Description Some default doctrine entity/fields requiring PHP >=8.2 and Doctrine ORM 3.2.
License MIT
Informations about the package doctrine-entities
doctrine-entities
Some default doctrine entity/fields requiring PHP >=8.2 and Doctrine ORM >=3.2.
For compatibility with Doctrine ORM <3.2 , see version <8.0 of this software.
This includes :
AbstractIntId
: a mapped superclass with an$id
as an integer identifier/primary key;IntId
: a trait that adds an$id
as an integer identifier/primary key;IntIdInterface
: an interface for integer id;Active
: a trait that adds an$active
boolean field;Available
: a trait that adds an$available
boolean field;Priority
: a trait that adds a$priority
integer field;Slug
: a trait that adds a$slug
text field;Name
: a trait that adds a$name
text field;Description
: a trait that adds a$description
text field;NullableDescription
: a trait that adds a nullable$description
text field;ConnectedAt
: two traits that add a$connectedAt
field (choose between \DateTime() or \DateTimeImmutable());CreatedAt
: two traits that add a$createdAt
field (choose between \DateTime() or \DateTimeImmutable());UpdatedAt
: two traits that add a$updatedAt
field (choose between \DateTime() or \DateTimeImmutable()).
Installation
As a Composer depedency
In your project directory run
For development purposes
Mappings
There are annotations, attributes and XML mappings. For XML mappings, read below.
Entity
The XML file is located in the config/doctrine/
directory.
You just have to copy or reference it depending on your needs.
If you use Symfony, the XML file just needs to be referenced in the resources/config/packages/doctrine.yaml
file :
Traits
You need to copy the require configuration in your XML file.
For example :
You can also look at the resources/mappings/Example.orm.xml
file.
Usage
AbstractIntId / IntId / IntIdInterface
In version <8.0, IntId
was an abstract class.
Due to uncertain support of
multiple inheritance mapped superclasses in different namespaces,
this is now a trait.
If your entities need an integer as an identifier/primary key :
-
they can extend the mapped super class
CyrilVerloop\DoctrineEntities\AbstractIntId
-
use the
CyrilVerloop\DoctrineEntities\IntId
trait - implement the
CyrilVerloop\DoctrineEntities\IntIdInterface
interface
Active / Available / Priority / Slug / Timestampable ...
If your entities need some other fields, they can use a trait.
Continuous integration
Tests
To run the tests :
The generated outputs will be in ./ci/phpunit/
.
Look at ./ci/phpunit/html/index.html
for code coverage
and ./ci/phpunit/testdox.html
for a verbose list of passing / failing tests.
To run mutation testing, you must run PHPUnit first, then :
The generated outputs will be in ./ci/infection/
.
Static analysis
To do a static analysis :
Use "--report=./psalm/psalm.txt --output-format=text" if you want the output in a file instead of on screen.
PHPDoc
To generate the PHPDoc :
The generated HTML documentation will be in ./ci/phpdoc/
.
Standard
All PHP files in this project follows PSR-12. To indent the code :