PHPackages                             consistence-community/consistence-doctrine - 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. consistence-community/consistence-doctrine

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

consistence-community/consistence-doctrine
==========================================

Integration of Consistence library with Doctrine ORM

2.1.4(2y ago)1324.9k↓34.8%3[1 issues](https://github.com/consistence-community/consistence-doctrine/issues)2MITPHPPHP ~7.4 || ~8.0

Since Jan 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/consistence-community/consistence-doctrine)[ Packagist](https://packagist.org/packages/consistence-community/consistence-doctrine)[ RSS](/packages/consistence-community-consistence-doctrine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (14)Used By (2)

Integration of Consistence library with Doctrine ORM
====================================================

[](#integration-of-consistence-library-with-doctrine-orm)

**This package is a fork of [`consistence/consistence-doctrine`](https://github.com/consistence/consistence-doctrine) maintained by community to support new PHP versions.**

---

This library provides integration of [Consistence](https://github.com/consistence-community/consistence) value objects for [Doctrine ORM](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/) so that you can use them in your entities.

For now, the only integration which is needed is for [Enums](https://github.com/consistence-community/consistence/blob/master/docs/Enum/enums.md), see the examples below.

Usage
-----

[](#usage)

[Enums](https://github.com/consistence-community/consistence/blob/master/docs/Enum/enums.md) represent predefined set of values and of course, you will want to store these values in your database as well. Since [`Enums`](https://github.com/consistence-community/consistence/blob/master/src/Enum/Enum.php) are objects and you only want to store the represented value, there has to be some mapping.

You can see it in this example where you want to store sex for your `User`s:

```
