This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier ba38ec5adf merged branch Romain-Geissler/read-only-form-datamapper-fix (PR #4280)
Commits
-------

47605f6 [Form][DataMapper] Do not update form to data when form is read only

Discussion
----------

[Form] [DataMapper] Read only form datamapper fix

The current 2.0.13 ``Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper`` enables to overwrite data from form values, no matter the form fields are read only or not.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

---------------------------------------------------------------------------

by travisbot at 2012-05-14T15:50:02Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1328279) (merged 47605f63 into 72b2f698).

---------------------------------------------------------------------------

by bschussek at 2012-05-14T18:06:41Z

Forms don't bind when they are read only, so why is this change necessary?

---------------------------------------------------------------------------

by stof at 2012-05-14T19:29:45Z

@bschussek A read-only child will not be bound but the setter will still be called on the parent object for this field (with the old value), making it mandatory to define setters for read-only fields.

---------------------------------------------------------------------------

by Romain-Geissler at 2012-05-14T19:43:11Z

In my case, the property is still set through a setter even if the field for this property is read only. The problem is the setter is not called with the legacy value it held, but with the value given by the form. In my case the value is transformed from a string to an object by a ``DataMapper``, which returns ``null`` for an empty string/value. Thus, the setter is called with ``null`` instead of the previous non ``null`` value (and not always the same) it held.

This PR just prevent the setter for an object property marked as read only in the form definition from being called.

---------------------------------------------------------------------------

by bschussek at 2012-05-15T08:20:28Z

Ok, 👍 then
2012-05-15 10:40:43 +02:00
src/Symfony merged branch Romain-Geissler/read-only-form-datamapper-fix (PR #4280) 2012-05-15 10:40:43 +02:00
tests [Form][DataMapper] Do not update form to data when form is read only 2012-05-14 17:35:21 +02:00
.gitignore add composer to gitignore in 2.0 2012-05-10 16:15:45 +03:00
.travis.yml also test PHP 5.3.2, since this is the official lowest supported PHP version 2011-12-26 01:15:21 +01:00
autoload.php.dist Allow autoload to run without vendors being cloned 2012-03-06 13:36:48 +01:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.13 2012-04-30 15:30:03 +02:00
check_cs [Check CS] don't replace 'else if' on twig files (closes #2961) 2011-12-27 16:10:32 +01:00
composer.json Bump monolog version 2012-04-25 10:00:53 +02:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.13 2012-04-30 15:30:38 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
phpunit.xml.dist [Security] cleaned up opt-in to benchmark test 2011-03-06 20:06:13 +01:00
README.md point the status icon to 2.0 2011-11-22 20:15:25 +01:00
UPDATE.ja.md updated translation of UPDATE file (Japanese RC5 added) 2011-07-30 02:08:25 +09:00
UPDATE.md UPDATE.md: trivial markdown syntax fix 2011-11-15 10:19:29 -08:00
vendors.php updated vendors for 2.0.13 2012-04-30 15:17:53 +02:00

README

Build Status

What is Symfony2?

Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements

Symfony2 is only supported on PHP 5.3.2 and up.

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony2 can help speed up your development and take the quality of your work to the next level, read the official Symfony2 documentation.

Contributing

Symfony2 is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.