Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge form branch #3

Merged
merged 73 commits into from
Mar 16, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
2a155e0
Introduced recursive form embed (fix many embed form issues)
jeromemacias Dec 26, 2011
b91798f
Fixed form embed with crsf protected
jeromemacias Dec 29, 2011
4b42301
[sfDoctrinePlugin] Fixed generator generator form template for many t…
jeromemacias Dec 29, 2011
db8caf7
Removed usage of array_map in widget
jeromemacias Dec 29, 2011
ee9ba2b
Added sfForm::getErrors method and corresponding unit test
jeromemacias Dec 29, 2011
b03fc37
Added default parameter to sfWidget::getOption method
jeromemacias Dec 29, 2011
1b5ca4c
[sfDoctrinePlugin] Fixed again generator form template for many to ma…
jeromemacias Dec 29, 2011
3d88c1b
[sfDoctrinePlugin] Fixed sfFormDoctrine::removeFile does not remove f…
jeromemacias Dec 29, 2011
1337909
Added sfWidgetFormInputRead
jeromemacias Dec 29, 2011
3d0fbc0
Fixed typo
jeromemacias Dec 29, 2011
5c5bbb4
Removed usage of array_unique in getStylesheets and getJavascripts me…
jeromemacias Dec 29, 2011
2c4cf21
Added sfValidatorIp (extracted from symfony2)
jeromemacias Dec 29, 2011
1e3ff56
Added tests for sfValidatorIp (extracted from symfony2)
jeromemacias Dec 30, 2011
91c088c
Added sfValidatorChoice::isEmpty method to test if value is an array …
jeromemacias Dec 30, 2011
a68720b
Fixed typo
jeromemacias Dec 31, 2011
c845442
Added sfValidatorEqual
jeromemacias Jan 1, 2012
b5bf901
Fixed phpdoc for previous commit
jeromemacias Jan 1, 2012
5c161c1
Merge remote branch 'github/master' into form
GromNaN Jan 6, 2012
0f80417
Fix nb tests
GromNaN Jan 6, 2012
52a7bc3
Pre-validator can modify values
GromNaN Jan 6, 2012
322df26
Setup Travis-CI
GromNaN Jan 6, 2012
8ec225f
Update vendors swiftmailer v4.1.5 & doctrine1
GromNaN Jan 6, 2012
6465c39
Removed travis builds for php 5.3 and php 5.4
jeromemacias Jan 6, 2012
d3c21b1
Updated travis config
jeromemacias Jan 6, 2012
a8446c9
Fix unit test for php version > 5.2 and fixed travis configuration
jeromemacias Jan 7, 2012
d01163d
Used SQLite 3 for php 5.3 or later, as it's required for php 5.4
jeromemacias Jan 7, 2012
b5a2967
Renamed CHANGELOG, COPYRIGHT and LICENSE + added UPGRADE and WHATS_NEW
jeromemacias Jan 7, 2012
16bdc5f
Fixed WHATS_NEW formatting
jeromemacias Jan 7, 2012
a1b5047
Update copyright for LICENCE
jeromemacias Jan 7, 2012
45dc303
Update UPGRADE.md
jeromemacias Jan 7, 2012
c05099a
Update COPYRIGHT.md
jeromemacias Jan 7, 2012
f90d5d4
Reverted 42aa3f9d49114503da997f2919de8405607dc008
jeromemacias Jan 7, 2012
06dbb3b
Updated changelog
jeromemacias Jan 8, 2012
249a625
Added missing part of WHATS_NEW
jeromemacias Jan 8, 2012
df9e2c7
Updated README
jeromemacias Jan 8, 2012
0bbb79e
Added sfRequest::getOption() method
jeromemacias Jan 8, 2012
a2785eb
Added possibility to launch bin/coverage task for only one class
jeromemacias Jan 8, 2012
9f835b6
Call fastcgi_finish_request function if available on sfWebResponse::r…
jeromemacias Jan 8, 2012
57630e2
Slight refactoring of sfWebRequest class (see changelog)
jeromemacias Jan 8, 2012
d3781b7
Updated changelog for backported changes of 1.4 release
jeromemacias Jan 8, 2012
45dc265
Added missing unit tests for sfWebResponse
jeromemacias Jan 8, 2012
a1f53ba
Added trust_proxy param to factories.yml
jeromemacias Jan 8, 2012
6d1ac54
Updated WHATS_NEW
jeromemacias Jan 8, 2012
734c751
Added skip-build option to doctrine create model tables task (patch f…
jeromemacias Jan 8, 2012
9fc1e30
Fixed sfToolkit::stringToArray() when key contains more than one '-' …
jeromemacias Jan 9, 2012
e0b3112
Updated upgrade and whats_new files
jeromemacias Jan 14, 2012
f08655f
Merge remote-tracking branch 'origin/master' into form
jeromemacias Jan 14, 2012
6099b6c
Fixed sfValidatorErrorSchema and removed possibility to pass an array…
jeromemacias Jan 14, 2012
f608356
Updated call to sfValidatorErrorSchema due to previous commit
jeromemacias Jan 15, 2012
651c105
Removed unused sfWidgetFormSchemaForEach and sfValidatorSchemaForEach…
jeromemacias Jan 15, 2012
8db588f
Do not clone the form on embed anymore
jeromemacias Jan 15, 2012
74bd91e
Added possibility to set integer as name for named error
jeromemacias Jan 15, 2012
bd1eda8
Slight optimisation on sfWidgetFormSchema::render() method
jeromemacias Jan 15, 2012
a8f3d51
Updated upgrade and whats_new
jeromemacias Jan 15, 2012
0760727
Fixed sfValidatorEqual and added entry to whats_new
jeromemacias Jan 15, 2012
bdcba2c
Fixed sfValidatorErrorSchemaTest to be consitent with 1.4 release tests
jeromemacias Jan 15, 2012
ffa38ca
Removed uneeded test
jeromemacias Jan 15, 2012
3050c73
Merge remote-tracking branch 'origin/master' into form
jeromemacias Jan 15, 2012
a36beaa
Simplified sfForm::getErrors method
jeromemacias Jan 15, 2012
65c1007
Fixed typo in exception message [ci skip]
jeromemacias Mar 3, 2012
45448f5
Fixed possible warning in sfWidgetFormSelectCheckbox
jeromemacias Mar 3, 2012
c496f4c
Merge remote-tracking branch 'origin/master' into form
jeromemacias Mar 3, 2012
7f31bf3
Added unit test for sfWidgetFormDoctrineChoice
jeromemacias Mar 4, 2012
b6da48c
[sfDoctrinePlugin] Added widget sfWidgetFormDoctrineArrayChoice
jeromemacias Mar 4, 2012
f93c14b
Fixed whats_new syntax [ci skip]
jeromemacias Mar 4, 2012
9c28e1b
Merge remote-tracking branch 'origin/master' into form
jeromemacias Mar 9, 2012
f31f0f4
Merge remote-tracking branch 'origin/master' into form
jeromemacias Mar 9, 2012
38735d1
Fixed travis build status icon in readme [ci skip]
jeromemacias Mar 9, 2012
bbb003b
Added sfFormObject::saveObject() method
jeromemacias Mar 11, 2012
d44ebe2
Merge remote-tracking branch 'origin/master' into form
jeromemacias Mar 15, 2012
b5a9fa5
Fix doUpdateObject() scope.
GromNaN Mar 15, 2012
6f503a7
[yaml] Convert encofing only for strings
GromNaN Mar 16, 2012
239ace2
Update doctrine submodule reference
GromNaN Mar 16, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CHANGELOG
=========

* Added sfFormObject::saveObject() method
* Added skip-build option to sfDoctrineCreateModelTablesTask (patch from @estahn)
* better code coverage for sfWebRequest class unit tests
* added parameters proxy to sfWebRequest::getClientIp() method (default true)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://secure.travis-ci.org/LExpress/symfony1.png?branch=master)](http://travis-ci.org/LExpress/symfony1)
[![Build Status](https://secure.travis-ci.org/LExpress/symfony1.png?branch=form)](http://travis-ci.org/LExpress/symfony1)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted.


Symfony is a complete framework designed to optimize the development of web applications by way of several key features.
For starters, it separates a web application's business rules, server logic, and presentation views.
Expand Down
15 changes: 15 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ Plugin

The sfPropelPlugin has been removed.
Use the [sfPropelORMPlugin](https://github.com/propelorm/sfPropelORMPlugin) if you want to use the great Propel ORM.

Form
----

The `trim` option of `sfValidatorBase` is now set to `true` by default.

The method `sfForm::embedFormForForeach` have been removed.

Due to the new embed form enhancements:

* The form is not cloned anymore when it you embed it
* You cannot embed the same `sfForm` instance twice or more into an `sfForm`.
* You cannot added the same `sfValidatorErrorSchema` instance twice or more into an `sfValidatorErrorSchema`.
* The method `sfValidatorErrorSchema::addErrors` only accept an `sfValidatorErrorSchema` instance as argument.
+ The `sfValidatorErrorSchema` constructor no longer accept an array of errors as second argument.
67 changes: 67 additions & 0 deletions WHATS_NEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@ Service container
A service container have been added (extracted from the [symfony dependency injection component](http://components.symfony-project.org/dependency-injection/).
[More details](https://github.com/LExpress/symfony1/wiki/ServiceContainer) about the integration on symfony core.

Form
----

Many issues have been fixed for embedded form included:

* You can use `sfFormObject::updateObject()` without save, all embedded form objects are updated.
* You can use file upload into your embedded forms, files will be correctly removed in embedded forms using `sfWidgetFormInputFileEditable`.
* `sfFormObject::updateObject()` and `sfFormObject::save()` methods are call recursivly from embeded forms.
* You can use integer in `name` argument of `sfForm::embedForm`.

This fixes the following tickets :

* http://trac.symfony-project.org/ticket/4903
* http://trac.symfony-project.org/ticket/5805
* http://trac.symfony-project.org/ticket/5867
* http://trac.symfony-project.org/ticket/6937
* http://trac.symfony-project.org/ticket/7032
* http://trac.symfony-project.org/ticket/7440
* http://trac.symfony-project.org/ticket/8500
* http://trac.symfony-project.org/ticket/8800
* http://trac.symfony-project.org/ticket/9147
* http://trac.symfony-project.org/ticket/9172
* http://trac.symfony-project.org/ticket/9637

[BC Break] The form is not cloned anymore when you passed it to `sfForm::embedForm`.

The method `sfForm::embedFormForForeach()` have been removed.

A new method `sfForm::getErrors()` have been added.
This method returns an array with label as key and the validation error message as value (included embedded form errors).

Widget
------

A new parameter `default` have been added to the method `sfWidget::getOption`.

New widget `sfWidgetFormInputRead` have been added.
This allow you to display a readonly input without border, with the value of your choice AND an hidden input with real value and name for submit.

The method `sfWidgetFormDateRange::getStylesheets()` does not try to remove duplicate (fixes http://trac.symfony-project.org/ticket/9224).

Validator
---------

A new `sfValidatorIp`have been added (extracted from symfony2).

Action
------

Expand Down Expand Up @@ -48,6 +94,21 @@ Filesystem
Validator
---------

The method `sfValidatorSchema::preClean` now returns cleaned values (fixes http://trac.symfony-project.org/ticket/5952).
This allow you to modified into validotors defined in your form `preValidator.

The method `sfValidatorErrorSchema::addError` accept all possible name different of `null` as second argement.
This allow you to set integer name for named error (fixes http://trac.symfony-project.org/ticket/6112).

Also, the method `sfValidatorErrorSchema::addError` uses much less memory for complex form with many (recursive) embedded forms.

[BC Break] The method `sfValidatorErrorSchema::addErrors` only accept an `sfValidatorErrorSchema` instance as argument.

[BC Break] The `sfValidatorErrorSchema` constructor no longer accept an array of errors as second argument.

A new `sfValidatorEqual` have been added.
It take one required `value` option an an optional `strict` to compare strictly or not.

The `sfValidatorFile` now returns size error in Kilo Byte instead of Byte.

A new method `sfValidator::resetType()` have been added.
Expand Down Expand Up @@ -95,6 +156,12 @@ This allow you to use another directory for unit tests temporary files storage.
Doctrine
--------

### Widget

A new `sfWidgetFormDoctrineArrayChoice` have been added.
This allow you to use an array builded by a table method of a model to increase performance.
See unit tests for usage examples.

### Form generation

Added column name for foreign key colums.
Expand Down
7 changes: 4 additions & 3 deletions lib/autoload/sfCoreAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @subpackage autoload
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id: sfCoreAutoload.class.php 32415 2011-03-30 16:09:00Z Kris.Wallsmith
$
*
*/
class sfCoreAutoload
{
Expand Down Expand Up @@ -472,19 +472,20 @@ static public function make()
'sfvalidatordatetime' => 'validator/sfValidatorDateTime.class.php',
'sfvalidatordecorator' => 'validator/sfValidatorDecorator.class.php',
'sfvalidatoremail' => 'validator/sfValidatorEmail.class.php',
'sfvalidatorequal' => 'validator/sfValidatorEqual.class.php',
'sfvalidatorerror' => 'validator/sfValidatorError.class.php',
'sfvalidatorerrorschema' => 'validator/sfValidatorErrorSchema.class.php',
'sfvalidatorfile' => 'validator/sfValidatorFile.class.php',
'sfvalidatorfromdescription' => 'validator/sfValidatorFromDescription.class.php',
'sfvalidatorinteger' => 'validator/sfValidatorInteger.class.php',
'sfvalidatorip' => 'validator/sfValidatorIp.class.php',
'sfvalidatornumber' => 'validator/sfValidatorNumber.class.php',
'sfvalidatoror' => 'validator/sfValidatorOr.class.php',
'sfvalidatorpass' => 'validator/sfValidatorPass.class.php',
'sfvalidatorregex' => 'validator/sfValidatorRegex.class.php',
'sfvalidatorschema' => 'validator/sfValidatorSchema.class.php',
'sfvalidatorschemacompare' => 'validator/sfValidatorSchemaCompare.class.php',
'sfvalidatorschemafilter' => 'validator/sfValidatorSchemaFilter.class.php',
'sfvalidatorschemaforeach' => 'validator/sfValidatorSchemaForEach.class.php',
'sfvalidatorstring' => 'validator/sfValidatorString.class.php',
'sfvalidatortime' => 'validator/sfValidatorTime.class.php',
'sfvalidatorurl' => 'validator/sfValidatorUrl.class.php',
Expand Down Expand Up @@ -515,10 +516,10 @@ static public function make()
'sfwidgetforminputfileeditable' => 'widget/sfWidgetFormInputFileEditable.class.php',
'sfwidgetforminputhidden' => 'widget/sfWidgetFormInputHidden.class.php',
'sfwidgetforminputpassword' => 'widget/sfWidgetFormInputPassword.class.php',
'sfwidgetforminputread' => 'widget/sfWidgetFormInputRead.class.php',
'sfwidgetforminputtext' => 'widget/sfWidgetFormInputText.class.php',
'sfwidgetformschema' => 'widget/sfWidgetFormSchema.class.php',
'sfwidgetformschemadecorator' => 'widget/sfWidgetFormSchemaDecorator.class.php',
'sfwidgetformschemaforeach' => 'widget/sfWidgetFormSchemaForEach.class.php',
'sfwidgetformschemaformatter' => 'widget/sfWidgetFormSchemaFormatter.class.php',
'sfwidgetformschemaformatterlist' => 'widget/sfWidgetFormSchemaFormatterList.class.php',
'sfwidgetformschemaformattertable' => 'widget/sfWidgetFormSchemaFormatterTable.class.php',
Expand Down
33 changes: 20 additions & 13 deletions lib/form/addon/sfFormObject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* Base class for forms that deal with a single object.
*
*
* @package symfony
* @subpackage form
* @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
Expand All @@ -24,7 +24,7 @@ abstract class sfFormObject extends BaseForm

/**
* Returns the current model name.
*
*
* @return string
*/
abstract public function getModelName();
Expand All @@ -50,7 +50,7 @@ abstract protected function doUpdateObject($values);
* Processes cleaned up values.
*
* @param array $values An array of values
*
*
* @return array An array of cleaned up values
*/
abstract public function processValues($values);
Expand Down Expand Up @@ -108,7 +108,7 @@ public function bindAndSave($taintedValues, $taintedFiles = null, $con = null)
* @return mixed The current saved object
*
* @see doSave()
*
*
* @throws sfValidatorError If the form is not valid
*/
public function save($con = null)
Expand All @@ -123,10 +123,9 @@ public function save($con = null)
$con = $this->getConnection();
}

$con->beginTransaction();
try
{
$con->beginTransaction();

$this->doSave($con);

$con->commit();
Expand All @@ -150,18 +149,27 @@ public function save($con = null)
* @param mixed $con An optional connection object
*/
protected function doSave($con = null)
{
$this->updateObject();
$this->saveObject($con);
}

/**
* Save form object
*
* @param mixed $con An optional connection object
*/
public function saveObject($con = null)
{
if (null === $con)
{
$con = $this->getConnection();
}

$this->updateObject();

$this->getObject()->save($con);

// embedded forms
$this->saveEmbeddedForms($con);
$this->saveObjectEmbeddedForms($con);
}

/**
Expand Down Expand Up @@ -225,7 +233,7 @@ public function updateObjectEmbeddedForms($values, $forms = null)
* @param mixed $con An optional connection object
* @param array $forms An array of forms
*/
public function saveEmbeddedForms($con = null, $forms = null)
public function saveObjectEmbeddedForms($con = null, $forms = null)
{
if (null === $con)
{
Expand All @@ -241,12 +249,11 @@ public function saveEmbeddedForms($con = null, $forms = null)
{
if ($form instanceof sfFormObject)
{
$form->getObject()->save($con);
$form->saveEmbeddedForms($con);
$form->saveObject($con);
}
else
{
$this->saveEmbeddedForms($con, $form->getEmbeddedForms());
$this->saveObjectEmbeddedForms($con, $form->getEmbeddedForms());
}
}
}
Expand Down
Loading