Development

#4223 (Doctrine admin generator passes empty strings when a field is left blank)

You must first sign up to be able to contribute.

Ticket #4223 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Doctrine admin generator passes empty strings when a field is left blank

Reported by: jphilip Assigned to: Jonathan.Wage
Priority: minor Milestone:
Component: sfDoctrinePlugin Version: 1.0.17
Keywords: Cc:
Qualification: Unreviewed

Description

Problem with sfDoctrinePlugin code generator:

For regular fields like int, string... When no value is input in the form, an empty string is passed to Doctrine. This does not work for int as an empty string is not a valid integer.

Checking for an empty string and passing null in that case works and makes more sense even for strings as it sets a null value in the DB instead of an empty string:

in data/generator/sfDoctrineAdmin/template/actions/action.class.php:

<?php else: ?>

if ($<?php echo $this->getSingularName() ?><?php echo $name ?>?

== )

$this-><?php echo $this->getSingularName() ?>->set('<?php echo

$column->getName() ?>', null);

else

$this-><?php echo $this->getSingularName() ?>->set('<?php echo

$column->getName() ?>', $<?php echo $this->getSingularName() ?>['<?php echo $name ?>']); <?php endif; ?>

Change History

08/18/08 06:37:35 changed by jphilip

  • component changed from other to plugins.

10/22/08 19:38:28 changed by jphilip

  • owner changed from fabien to Jonathan.Wage.
  • component changed from plugins to sfDoctrinePlugin.

10/23/08 22:03:52 changed by Jonathan.Wage

  • status changed from new to closed.
  • resolution set to fixed.

(In [12353]) [1.0, 1.1, 1.2] fixes #4223