PHPackages                             elao/form-simple-object-mapper - 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. [Framework](/categories/framework)
4. /
5. elao/form-simple-object-mapper

Abandoned → [sensiolabs-de/rich-model-forms-bundle](/?search=sensiolabs-de%2Frich-model-forms-bundle)ArchivedLibrary[Framework](/categories/framework)

elao/form-simple-object-mapper
==============================

Ease mapping immutable/value objects to Symfony Forms

v1.1.0(8y ago)16874MITPHPPHP &gt;=5.6

Since Nov 14Pushed 7y ago5 watchersCompare

[ Source](https://github.com/Elao/FormSimpleObjectMapper)[ Packagist](https://packagist.org/packages/elao/form-simple-object-mapper)[ Docs](https://github.com/Elao/FormSimpleObjectMapper)[ RSS](/packages/elao-form-simple-object-mapper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (16)Versions (3)Used By (0)

⚠️ This package is abandoned in favor of using  with the `factory` option and a callable.
See [https://github.com/sensiolabs-de/rich-model-forms-bundle/blob/master/docs/factory\_value\_object.md#initializing-objects](https://github.com/sensiolabs-de/rich-model-forms-bundle/blob/master/docs/factory_value_object.md#initializing-objects) for more infos.

---

Symfony Form Simple Object Mapper
=================================

[](#symfony-form-simple-object-mapper)

[![Latest Stable Version](https://camo.githubusercontent.com/f92803c1a2a0981730ed26c2ce42f36e71ccc75d715d86108a139f54fffc19df/68747470733a2f2f706f7365722e707567782e6f72672f656c616f2f666f726d2d73696d706c652d6f626a6563742d6d61707065722f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/elao/form-simple-object-mapper)[![Total Downloads](https://camo.githubusercontent.com/50a329e0a4a0eb912016182566a3e4d4c561451765fe2d5a98c36bbbb53b3b16/68747470733a2f2f706f7365722e707567782e6f72672f656c616f2f666f726d2d73696d706c652d6f626a6563742d6d61707065722f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/elao/form-simple-object-mapper)[![Monthly Downloads](https://camo.githubusercontent.com/82a821085d8cb37c2f07565011c32842c7c3e9a754d32513baf02c3cb950d211/68747470733a2f2f706f7365722e707567782e6f72672f656c616f2f666f726d2d73696d706c652d6f626a6563742d6d61707065722f642f6d6f6e74686c793f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/elao/form-simple-object-mapper)[![Build Status](https://camo.githubusercontent.com/7b04d4a8fe128b57fd559e73f9f1d4a83eb49f768d77a1f34c4eb4c1c0e01434/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f456c616f2f466f726d53696d706c654f626a6563744d61707065722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Elao/FormSimpleObjectMapper)[![Coveralls](https://camo.githubusercontent.com/9af704a7df4da9fe02bd26ff2522a9306e94accab318b3624d99759c15909087/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f456c616f2f466f726d53696d706c654f626a6563744d61707065722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/Elao/FormSimpleObjectMapper)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/913d19c4954590647caf7047d97414d5b769e07f4def33415ca00bc365dc4cbe/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f456c616f2f466f726d53696d706c654f626a6563744d61707065722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Elao/FormSimpleObjectMapper/?branch=master)[![Symfony](https://camo.githubusercontent.com/1a1a23889f0830f39bfb40c5d364a1d3ee2827d7657379701edc63d43741741a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253230322e38253246332e34253246342e302532422d677265656e2e7376673f7374796c653d666c61742d737175617265 "Available for Symfony 2.8, 3.4 and 4.0+")](https://symfony.com)[![php](https://camo.githubusercontent.com/a61a3990fc7980e135b6d9cf83be9cfe0828864291531176094bc2de0157b0aa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372d677265656e2e7376673f7374796c653d666c61742d737175617265 "Available for PHP 7+")](http://php.net/)

This library aims to ease immutable or value objects mapping with the Symfony Form component, based on [Bernhard Schussek (Webmozart)](https://github.com/webmozart)'s blog post: ["Value Objects in Symfony Forms"](https://webmozart.io/blog/2015/09/09/value-objects-in-symfony-forms/), until a decision on [symfony/symfony#19367](https://github.com/symfony/symfony/pull/19367) is made.

Table of Contents
=================

[](#table-of-contents)

- [Installation](#installation)
    - [With Symfony Full Stack framework](#with-symfony-full-stack-framework)
    - [With Symfony Form component only](#with-symfony-form-component-only)
- [Usage](#usage)
- [Advanced usage](#advanced-usage)
    - [Using a callback](#using-a-callback)
    - [Handle conversion errors](#handle-conversion-errors)
    - [Convert form data to null](#convert-form-data-to-null)
    - [Map an object to the form](#map-an-object-to-the-form)

Installation
============

[](#installation)

```
$ composer require elao/form-simple-object-mapper
```

With Symfony Full Stack framework
---------------------------------

[](#with-symfony-full-stack-framework)

```
