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

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

consistence/consistence-doctrine-symfony
========================================

Symfony Bundle integrating Consistence library with Doctrine ORM

3.0(1y ago)5279.1k↓30.8%9[4 PRs](https://github.com/consistence/consistence-doctrine-symfony/pulls)MITPHPPHP ^7.2CI passing

Since Jan 14Pushed 1y ago3 watchersCompare

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

READMEChangelog (7)Dependencies (12)Versions (11)Used By (0)

Symfony Bundle integrating Consistence library with Doctrine ORM
================================================================

[](#symfony-bundle-integrating-consistence-library-with-doctrine-orm)

> This is a Symfony bundle providing integration for the standalone package [`consistence/consistence-doctrine`](https://github.com/consistence/consistence-doctrine), if you are not using Symfony, follow instructions there.

This bundle provides integration of [Consistence](https://github.com/consistence/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/consistence/blob/master/docs/Enum/enums.md), see the examples below.

Usage
-----

[](#usage)

[Enums](https://github.com/consistence/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/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:

```
