Revision: 165
http://sourceforge.net/p/beeframework/code/165
Author: m_plomer
Date: 2014-07-02 14:19:15 +0000 (Wed, 02 Jul 2014)
Log Message:
-----------
- MVC MethodNameResolver: annotation-based - ajax flag introduced
Modified Paths:
--------------
trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php
Modified: trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php
===================================================================
--- trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php 2014-07-02 12:46:18 UTC (rev 164)
+++ trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php 2014-07-02 14:19:15 UTC (rev 165)
@@ -68,8 +68,7 @@
$this->init();
- $httpMethod = strtoupper($request->getMethod());
-
+ $httpMethod = $this->getMethodNameKey($request->getMethod());
$ajaxKeyPart = $this->getAjaxTypeKey($request->getAjax());
return $this->selectHandlerMethod(array(
$httpMethod . $ajaxKeyPart,
@@ -126,13 +125,8 @@
$annotations = $method->getAllAnnotations('Bee_MVC_Controller_Multiaction_RequestHandler');
foreach($annotations as $annotation) {
- $httpMethod = strtoupper($annotation->httpMethod);
- $ajax = filter_var($annotation->ajax, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
- $ajax = $this->getAjaxTypeKey($ajax);
- if(!Bee_Utils_Strings::hasText($httpMethod)) {
- $httpMethod = self::DEFAULT_HTTP_METHOD_KEY;
- }
- $httpMethod .= $httpMethod . $ajax;
+ $httpMethod = $this->getMethodNameKey($annotation->httpMethod) .
+ $this->getAjaxTypeKey(filter_var($annotation->ajax, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
if(!array_key_exists($httpMethod, $mappings)) {
$mappings[$httpMethod] = array();
}
@@ -158,6 +152,14 @@
}
/**
+ * @param $methodName
+ * @return string
+ */
+ protected function getMethodNameKey($methodName) {
+ return Bee_Utils_Strings::hasText($methodName) ? strtoupper($methodName) : self::DEFAULT_HTTP_METHOD_KEY;
+ }
+
+ /**
* @param bool|null $ajax
* @return string
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|