[Beeframework-svn] SF.net SVN: beeframework:[239] trunk
Brought to you by:
b_hartmann,
m_plomer
|
From: <m_p...@us...> - 2014-09-28 22:03:13
|
Revision: 239
http://sourceforge.net/p/beeframework/code/239
Author: m_plomer
Date: 2014-09-28 22:03:01 +0000 (Sun, 28 Sep 2014)
Log Message:
-----------
Persistence: fixed bug in PaginationBase
MVC: Dispatcher now accepts a MAV also from Interceptors, bypasses rest of chain and controller in that case
Modified Paths:
--------------
trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php
trunk/examples/classes/Test/Mvc/ParamTestDelegate.php
trunk/examples/conf/views.xml
trunk/examples/index.php
trunk/framework/Bee/MVC/Dispatcher.php
trunk/framework/Bee/Persistence/PaginationBase.php
Modified: trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php
===================================================================
--- trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php 2014-09-26 18:41:49 UTC (rev 238)
+++ trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php 2014-09-28 22:03:01 UTC (rev 239)
@@ -13,10 +13,12 @@
/**
*
* @Bee_MVC_Controller_Multiaction_RequestHandler(httpMethod = "GET", pathPattern = "/**\/testClassic/**")
+ * @param Bee_MVC_IHttpRequest $request
+ * @return bool
*/
public function handleTestParams(Bee_MVC_IHttpRequest $request) {
- var_dump($request);
- return true;
+// var_dump($request);
+ return new \Bee_MVC_ModelAndView(array('delegateName' => get_class($this)), 'testview');
}
-
+kk
}
\ No newline at end of file
Modified: trunk/examples/classes/Test/Mvc/ParamTestDelegate.php
===================================================================
--- trunk/examples/classes/Test/Mvc/ParamTestDelegate.php 2014-09-26 18:41:49 UTC (rev 238)
+++ trunk/examples/classes/Test/Mvc/ParamTestDelegate.php 2014-09-28 22:03:01 UTC (rev 239)
@@ -21,10 +21,11 @@
* @param MC $testParam
* @param boolean $getParam
* @return bool
+ * @Bee_MVC_Controller_Multiaction_RequestHandler(httpMethod = "GET", pathPattern = "/**\/testClassic/**")
* @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**\/ghi/*\/{0}/{2}/const/{boolParam}", httpMethod="GET")
* @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**\/{0}/{2}/{boolParam}", httpMethod="POST")
*/
- public function handleTestParams($paramA, Bee_MVC_IHttpRequest $request, MC $paramB, $boolParam = false, $testParam = null, $getParam = false) {
+ public function handleTestParams($paramA = null, Bee_MVC_IHttpRequest $request, MC $paramB, $boolParam = false, $testParam = null, $getParam = false) {
echo '<hr/>'. get_class($this) .'::'. __FUNCTION__ .'<hr/>';
// var_dump($paramA);
// var_dump($paramB);
@@ -64,6 +65,9 @@
/**
*
* @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**\/testParam/{paramA}/")
+ * @param MC $paramB
+ * @param Bee_MVC_IHttpRequest $request
+ * @return bool
*/
public function handleTestParams2(MC $paramB, Bee_MVC_IHttpRequest $request) {
echo '<hr/>'. get_class($this) .'::'. __FUNCTION__ .'<hr/>';
@@ -75,7 +79,7 @@
/**
* @param int $getParam
* @return Bee_MVC_ModelAndView
- * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**")
+ * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**", httpMethod="GET")
*/
public function handleDefault($getParam = 1000) {
echo '<hr/>'. get_class($this) .'::'. __FUNCTION__ .'<hr/>';
Modified: trunk/examples/conf/views.xml
===================================================================
--- trunk/examples/conf/views.xml 2014-09-26 18:41:49 UTC (rev 238)
+++ trunk/examples/conf/views.xml 2014-09-28 22:03:01 UTC (rev 239)
@@ -3,4 +3,5 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd">
+ <bean id="testview" class="Bee_MVC_View_JsonService" />
</beans>
Modified: trunk/examples/index.php
===================================================================
--- trunk/examples/index.php 2014-09-26 18:41:49 UTC (rev 238)
+++ trunk/examples/index.php 2014-09-28 22:03:01 UTC (rev 239)
@@ -11,4 +11,4 @@
Bee_Cache_Manager::init();
//Bee_Framework::setProductionMode(true);
-Bee_Framework::dispatchRequestUsingXmlContext(__DIR__.'/conf/context-mvc.xml');
\ No newline at end of file
+Bee_Framework::dispatchRequestUsingXmlContext(__DIR__.'/conf/context-newinterceptors.xml');
\ No newline at end of file
Modified: trunk/framework/Bee/MVC/Dispatcher.php
===================================================================
--- trunk/framework/Bee/MVC/Dispatcher.php 2014-09-26 18:41:49 UTC (rev 238)
+++ trunk/framework/Bee/MVC/Dispatcher.php 2014-09-28 22:03:01 UTC (rev 239)
@@ -262,25 +262,31 @@
$mav = null;
$interceptors = array();
$handlerException = null;
+ $interceptorIndex = -1;
try {
-
$mappedHandler = $this->handlerMapping->getHandler($request);
$interceptors = $mappedHandler->getInterceptors();
$handler = $mappedHandler->getHandler();
-// $interceptorIndex = -1;
-
+ $mav = null;
for ($i = 0; $i < count($interceptors); $i++) {
$interceptor = $interceptors[$i];
- if (!$interceptor->preHandle($request, $handler)) {
+ $interceptorResult = $interceptor->preHandle($request, $handler);
+ if (!$interceptorResult) {
// $this->triggerAfterCompletion($handler, $interceptorIndex, $request, null);
return;
}
-// $interceptorIndex = $i;
+ $interceptorIndex = $i;
+ if($interceptorResult instanceof Bee_MVC_ModelAndView) {
+ $mav = $interceptorResult;
+ break;
+ }
}
// @todo: introduce HandlerAdapter
- $mav = $handler->handleRequest($request);
+ if(is_null($mav)) {
+ $mav = $handler->handleRequest($request);
+ }
} catch (Exception $e) {
$this->getLog()->warn('handler or interceptor exception caught, trying to resolve appropriate error view', $e);
@@ -308,7 +314,7 @@
$interceptors = $this->handlerMapping->getInterceptors();
}
// Apply postHandle methods of registered interceptors.
- for ($i = count($interceptors) - 1; $i >= 0; $i--) {
+ for ($i = $interceptorIndex; $i >= 0; $i--) {
$interceptor = $interceptors[$i];
$interceptor->postHandle($request, $handler, $mav);
}
Modified: trunk/framework/Bee/Persistence/PaginationBase.php
===================================================================
--- trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-26 18:41:49 UTC (rev 238)
+++ trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-28 22:03:01 UTC (rev 239)
@@ -71,7 +71,6 @@
* @param $currentPage
*/
public function setCurrentPage($currentPage) {
- $currentPage = $currentPage > $this->getPageCount() - 1 ? $this->getPageCount() - 1 : $currentPage;
$currentPage = $currentPage < 0 ? 0 : $currentPage;
$this->currentPage = $currentPage;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|