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

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

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

Symfony Bundle integrating Consistence library and Doctrine ORM with Symfony 5 support

3.0(5y ago)05MITPHPPHP ~7.3

Since Jan 14Pushed 5y agoCompare

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

READMEChangelog (1)Dependencies (10)Versions (8)Used By (0)

Symfony Bundle integrating Consistence library and Doctrine ORM with Symfony 5 support
======================================================================================

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

[![Travis CI](https://camo.githubusercontent.com/2efb80fd729ff861d907211d2e635498c6366c2a8c9e72d5be5ed07092934397/68747470733a2f2f7472617669732d63692e6f72672f73636174746572637a2f636f6e73697374656e63652d646f637472696e652d73796d666f6e792e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/2efb80fd729ff861d907211d2e635498c6366c2a8c9e72d5be5ed07092934397/68747470733a2f2f7472617669732d63692e6f72672f73636174746572637a2f636f6e73697374656e63652d646f637472696e652d73796d666f6e792e7376673f6272616e63683d6d6173746572)

> 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.

This bundle was updated so it is now working in Symfony 5 and PHP 7.4.

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:

```
