Author: garak
Date: 2010-08-30 18:03:13 +0200 (Mon, 30 Aug 2010)
New Revision: 30786

Modified:
   plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetForm.class.php
Log:
[sfAssetsLibraryPlugin] changed from doSave to updateObject in sfAssetForm to 
allow saving of external objects


Modified: 
plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetForm.class.php
===================================================================
--- plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetForm.class.php   
2010-08-30 12:04:37 UTC (rev 30785)
+++ plugins/sfAssetsLibraryPlugin/branches/1.3/lib/form/sfAssetForm.class.php   
2010-08-30 16:03:13 UTC (rev 30786)
@@ -56,29 +56,25 @@
   }
 
   /**
-   * save
-   * @param PropelPDO $con
+   * save physical file when adding new asset
+   * @param  array   $values
+   * @return sfAsset
    */
-  protected function doSave($con = null)
+  public function updateObject($values = null)
   {
-    if (null === $con)
+    $object = parent::updateObject($values);
+    if ($object->isNew())
     {
-      $con = $this->getConnection();
-    }
-    $this->updateObject();
-    if ($this->getObject()->isNew())
-    {
       $file = $this->getValue('file');
-      $this->getObject()->setAuthor($this->getOption('author'));
-      $this->getObject()->setFilename($file->getOriginalName());
+      $object->setAuthor($this->getOption('author'));
+      $object->setFilename($file->getOriginalName());
       if ($this->getValue('description') == '')
       {
-        $this->getObject()->setDescription($file->getOriginalName());
+        $object->setDescription($file->getOriginalName());
       }
-      $this->getObject()->create($file->getTempName());
+      $object->create($file->getTempName());
     }
-    $this->getObject()->save($con);
-    // embedded forms
-    $this->saveEmbeddedForms($con);
+
+    return $object;
   }
 }
\ No newline at end of file

-- 
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