Author: marijn
Date: 2010-01-16 00:26:32 +0100 (Sat, 16 Jan 2010)
New Revision: 26703
Modified:
plugins/sfPaymentPlugin/branches/1.2-marijn/lib/action/sfPaymentActionAbstract.php
Log:
[sfPaymentPlugin] Refined `sfPaymentActionAbstract` class, the `_doProcessForm`
method now returns the routing information for the redirect.
Modified:
plugins/sfPaymentPlugin/branches/1.2-marijn/lib/action/sfPaymentActionAbstract.php
===================================================================
---
plugins/sfPaymentPlugin/branches/1.2-marijn/lib/action/sfPaymentActionAbstract.php
2010-01-15 22:55:20 UTC (rev 26702)
+++
plugins/sfPaymentPlugin/branches/1.2-marijn/lib/action/sfPaymentActionAbstract.php
2010-01-15 23:26:32 UTC (rev 26703)
@@ -1,12 +1,12 @@
<?php
/**
- * sfPaymentActionAbstract.
+ * sfPaymentActionAbstract
*
+ * @package sfPaymentPlugin
* @author Marijn Huizendveld <[email protected]>
- * @version $Revision: 209 $ changed by $Author: marijn $
*
- * @copyright Round 84 (2009)
+ * @version $Revision$ changed by $Author$
*/
abstract class sfPaymentActionAbstract extends sfAction
{
@@ -14,12 +14,13 @@
/**
* Process a form object.
*
- * @param sfPaymentFormAbstract $arg_form The form to process.
- * @param sfWebRequest $arg_request The request object.
- * @param mixed $arg_route The route to which the
form data should be submitted.
- * @param string $arg_method The form submit method.
+ * @param sfPaymentFormAbstract $arg_form The form to process
+ * @param sfWebRequest $arg_request The request object
+ * @param mixed $arg_route The route to which the form
+ * data should be submitted
+ * @param string $arg_method The form submit method
*
- * @return string The view type to render.
+ * @return string The view type to render
*/
protected function _processForm (sfPaymentFormAbstract $arg_form,
sfWebRequest $arg_request, $arg_route, $arg_method = 'post')
{
@@ -27,16 +28,18 @@
if ($arg_request->isMethod($arg_method) &&
$arg_request->hasParameter($name))
{
- $arg_form->bind($arg_request->getParameter($name),
$arg_form->isMultipart() ? $arg_request->getFiles($name) : NULL);
+ $files = $arg_form->isMultipart() ? $arg_request->getFiles($name) :
NULL;
+ $arg_form->bind($arg_request->getParameter($name), $files);
+
if ($arg_form->isValid())
{
- $object = $this->_doProcessForm($arg_form);
- $route = is_callable($arg_route) ? call_user_func($arg_route,
$object) : array('sf_route' => $arg_route
-
,'sf_subject' => $object
-
);
+ $route = $this->_doProcessForm($arg_form, $arg_request, $arg_route);
- $this->redirect($route);
+ if (NULL !== $route)
+ {
+ $this->redirect($route);
+ }
}
}
@@ -46,13 +49,18 @@
/**
* Process a form object when it is valid.
*
- * @param sfPaymentFormAbstract $arg_form The form to process.
+ * @param sfForm $arg_form The form to process
+ * @param sfWebRequest $arg_request The request object
+ * @param String $arg_route The route to which the form data
+ * should be submitted
*
- * @return mixed
+ * @return array Representing the routing data
*/
- protected function _doProcessForm (sfPaymentFormAbstract $arg_form)
+ protected function _doProcessForm (sfForm $arg_form, sfWebRequest
$arg_request, $arg_route)
{
- return $arg_form->process();
+ return array('sf_route' => $arg_route
+ ,'sf_subject' => $arg_form->save()
+ );
}
}
\ No newline at end of file
Property changes on:
plugins/sfPaymentPlugin/branches/1.2-marijn/lib/action/sfPaymentActionAbstract.php
___________________________________________________________________
Added: svn:keywords
+ Revision Author
--
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.