Author: Russ
Date: 2010-03-05 23:54:08 +0100 (Fri, 05 Mar 2010)
New Revision: 28394

Modified:
   plugins/sfDoctrinePlugin/branches/1.3-2.0/lib/form/sfFormDoctrine.class.php
Log:
[1.4][sfDoctrine2Plugin] Fix call to deprecated function in Doctrine revision 
7313


Modified: 
plugins/sfDoctrinePlugin/branches/1.3-2.0/lib/form/sfFormDoctrine.class.php
===================================================================
--- plugins/sfDoctrinePlugin/branches/1.3-2.0/lib/form/sfFormDoctrine.class.php 
2010-03-05 15:34:06 UTC (rev 28393)
+++ plugins/sfDoctrinePlugin/branches/1.3-2.0/lib/form/sfFormDoctrine.class.php 
2010-03-05 22:54:08 UTC (rev 28394)
@@ -518,7 +518,13 @@
   protected function getObjectValue($fields)
   {
     $md = 
$this->em->getMetadataFactory()->getMetadataFor($this->getModelName());
-    $values = $md->getColumnsValue((array)$fields);
+    $values = array();
+
+    foreach ((array) $fields as $aField)
+    {
+      $values[] = $md->reflFields[$aField]->getValue($this->getObject());
+    }
+
     if (is_array($fields))
     {
       return $values;
@@ -528,10 +534,8 @@
 
   protected function convertObjectToArray()
   {
-    $md = 
$this->em->getMetadataFactory()->getMetadataFor($this->getModelName());
-    $values = $md->getColumnValues($this->getObject(), 
array_keys($md->fieldNames));
-    $valueArray = array_combine($md->fieldNames, $values);
     $obj = $this->getObject();
+    $valueArray = $this->getObjectColumnValues();
 
     foreach($valueArray as $key => $value)
     {
@@ -546,6 +550,26 @@
   }
 
   /**
+   * Get the property values of the form object for all properties mapped
+   * to database columns
+   *
+   * @return array fieldname => $value
+   */
+  protected function getObjectColumnValues()
+  {
+    $md = 
$this->em->getMetadataFactory()->getMetadataFor($this->getModelName());
+    $columns = array_keys($md->fieldNames);
+
+    $values = array();
+    foreach ($columns as $column) {
+      $values[] = 
$md->reflFields[$md->fieldNames[$column]]->getValue($this->getObject());
+    }
+    $valueArray = array_combine($md->fieldNames, $values);
+
+    return $valueArray;
+  }
+
+  /**
    * Saves the uploaded file for the given field.
    *
    * @param  string $field The field 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.

Reply via email to