Author: uncleringo
Date: 2010-05-20 11:03:02 +0200 (Thu, 20 May 2010)
New Revision: 29545
Modified:
plugins/sfTrafficCMSPlugin/trunk/lib/form/TrafficCMSBaseForm.class.php
Log:
Removed save of Doctrine_Collection children so fix creation of empty entries
Modified: plugins/sfTrafficCMSPlugin/trunk/lib/form/TrafficCMSBaseForm.class.php
===================================================================
--- plugins/sfTrafficCMSPlugin/trunk/lib/form/TrafficCMSBaseForm.class.php
2010-05-19 21:52:25 UTC (rev 29544)
+++ plugins/sfTrafficCMSPlugin/trunk/lib/form/TrafficCMSBaseForm.class.php
2010-05-20 09:03:02 UTC (rev 29545)
@@ -323,7 +323,7 @@
: preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')", $model_name);
$children = $object->get($model_class . 's');
-
+ $children->loadRelated();
foreach ($children as $key => $object_to_embed)
{
$object_count++;
@@ -336,6 +336,8 @@
continue;
}
+ $children[$key]->refreshRelated();
+
$form_class = get_class($object_to_embed) . 'Form';
$widget_form = new $form_class($object_to_embed, array(
@@ -356,23 +358,18 @@
);
}
-
- $children->save();
-// $object->set($model_class . 's', $children);
-// if ($object_count > 0)
-// {
- $this->embedForm($embedded_form_name, $form_to_embed);
- $this->setWidgetSchema(
- $this->getWidgetSchema()->setLabel(
- $embedded_form_name,
- isset($options['form_label'])
- ? $options['form_label']
- : ucfirst(str_replace('_', ' ', $model_name))
- )
- );
-// }
+ $this->embedForm($embedded_form_name, $form_to_embed);
+ $this->setWidgetSchema(
+ $this->getWidgetSchema()->setLabel(
+ $embedded_form_name,
+ isset($options['form_label'])
+ ? $options['form_label']
+ : ucfirst(str_replace('_', ' ', $model_name))
+ )
+ );
+
if (!$object->isNew() && $object_count < $options['max_records']) {
$model_class = preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')",
$model_name);
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.