beeframework-svn Mailing List for Bee Framework (Page 7)
Brought to you by:
b_hartmann,
m_plomer
You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(12) |
Jun
(5) |
Jul
(6) |
Aug
(25) |
Sep
(25) |
Oct
(6) |
Nov
(29) |
Dec
|
| 2014 |
Jan
(2) |
Feb
(10) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(35) |
Aug
(9) |
Sep
(33) |
Oct
(30) |
Nov
(4) |
Dec
(1) |
| 2015 |
Jan
(3) |
Feb
(13) |
Mar
(13) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <m_p...@us...> - 2014-02-26 13:57:03
|
Revision: 146
http://sourceforge.net/p/beeframework/code/146
Author: m_plomer
Date: 2014-02-26 13:56:55 +0000 (Wed, 26 Feb 2014)
Log Message:
-----------
- cache deserialization error handling by Bugs
Modified Paths:
--------------
trunk/framework/Bee/Cache/Manager.php
trunk/framework/Bee/Cache/Provider/Base.php
trunk/framework/Bee/Framework.php
trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php
Modified: trunk/framework/Bee/Cache/Manager.php
===================================================================
--- trunk/framework/Bee/Cache/Manager.php 2014-02-17 12:35:01 UTC (rev 145)
+++ trunk/framework/Bee/Cache/Manager.php 2014-02-26 13:56:55 UTC (rev 146)
@@ -143,53 +143,78 @@
}
}
- /**
- * Enter description here...
- *
- * @param Bee_Cache_ICachableResource $resource
- * @return mixed
- */
- public static function &retrieveCachable(Bee_Cache_ICachableResource $resource, $returnInfoArray = false) {
- if(is_null(self::$provider)) {
- // no cache provider found, no caching or unsupported cache type installed
- $data =& $resource->createContent();
- $result = $returnInfoArray ? array(self::INFO_NO_CACHE_KEY => true, self::INFO_CACHE_HIT_KEY => false, self::INFO_IN_CACHE_SINCE_KEY => false, self::INFO_DATA_KEY => &$data) : $data;
- return $result;
- }
-
- // caching supported, check if in cache and not stale
- $key = self::getQualifiedKey($resource->getKey());
- $ctimeKey = $key . self::CTIME_KEY_SUFFIX;
+ /**
+ * Enter description here...
+ *
+ * @param Bee_Cache_ICachableResource $resource
+ * @return mixed
+ */
+ public static function &retrieveCachable(Bee_Cache_ICachableResource $resource, $returnInfoArray = false) {
+ if(is_null(self::$provider)) {
+ // no cache provider found, no caching or unsupported cache type installed
+ $data =& $resource->createContent();
+ $result = $returnInfoArray ? array(self::INFO_NO_CACHE_KEY => true, self::INFO_CACHE_HIT_KEY => false, self::INFO_IN_CACHE_SINCE_KEY => false, self::INFO_DATA_KEY => &$data) : $data;
+ return $result;
+ }
- $inCacheSince = self::$provider->retrieve($ctimeKey);
- $inCacheSince = $inCacheSince === false ? -1 : $inCacheSince;
+ // caching supported, check if in cache and not stale
+ $key = self::getQualifiedKey($resource->getKey());
+ $ctimeKey = $key . self::CTIME_KEY_SUFFIX;
- $mtime = $resource->getModificationTimestamp();
+ try {
+ $inCacheSince = self::$provider->retrieve($ctimeKey);
+ $inCacheSince = $inCacheSince === false ? -1 : $inCacheSince;
- if($inCacheSince < $mtime) {
- // @todo: provide logging
- // resource not found in cache or stale, re-create and store in cache
+ } catch (Exception $e) {
+ $inCacheSince = -1;
+ }
- $etime = 0;
- $data =& $resource->createContent($etime);
+ $mtime = $resource->getModificationTimestamp();
- self::$provider->store($ctimeKey, $mtime, $etime);
- self::$provider->store($key, $data, $etime);
+ if($inCacheSince < $mtime) {
+ // @todo: provide logging
+ // resource not found in cache or stale, re-create and store in cache
- $cacheHit = false;
- } else {
- // @todo: provide logging
- // resource in cache is current, fetch from cache
- $data = self::$provider->retrieve($key);
- $cacheHit = true;
- }
+ $etime = 0;
+ $data =& $resource->createContent($etime);
- if($returnInfoArray) {
- $data = array(self::INFO_CACHE_HIT_KEY => $cacheHit, self::INFO_IN_CACHE_SINCE_KEY => $inCacheSince, self::INFO_DATA_KEY => &$data);
- }
- return $data;
- }
+ self::$provider->store($ctimeKey, $mtime, $etime);
+ self::$provider->store($key, $data, $etime);
+ $cacheHit = false;
+ } else {
+ // @todo: provide logging
+ // resource in cache is current, fetch from cache
+ try {
+ $data = self::$provider->retrieve($key);
+ $cacheHit = true;
+
+ } catch (Exception $e) {
+ // ACHTUNG!!!!!!!!
+ // ACHTUNG!!!!!!!!
+ // ACHTUNG!!!!!!!!
+ // ACHTUNG!!!!!!!!
+ //
+ // hier habe ich einfach ein stück code aus dem if ... zweig dupliziert
+ //
+ // @todo: provide logging
+ // resource not found in cache or stale, re-create and store in cache
+ $etime = 0;
+ $data =& $resource->createContent($etime);
+
+ self::$provider->store($ctimeKey, $mtime, $etime);
+ self::$provider->store($key, $data, $etime);
+
+ $cacheHit = false;
+ }
+ }
+
+ if($returnInfoArray) {
+ $data = array(self::INFO_CACHE_HIT_KEY => $cacheHit, self::INFO_IN_CACHE_SINCE_KEY => $inCacheSince, self::INFO_DATA_KEY => &$data);
+ }
+ return $data;
+ }
+
public static function retrieve($key) {
return self::$provider->retrieve(self::getQualifiedKey($key));
}
Modified: trunk/framework/Bee/Cache/Provider/Base.php
===================================================================
--- trunk/framework/Bee/Cache/Provider/Base.php 2014-02-17 12:35:01 UTC (rev 145)
+++ trunk/framework/Bee/Cache/Provider/Base.php 2014-02-26 13:56:55 UTC (rev 146)
@@ -44,9 +44,14 @@
return $this->doStore($key, serialize($value), $etime);
}
- protected function doRetrieveSerialized($key) {
- return unserialize($this->doRetrieve($key));
- }
+ protected function doRetrieveSerialized($key) {
+ $serialized = $this->doRetrieve($key);
+ $data = @unserialize($serialized);
+ if ($data === false && $serialized !== serialize(false)) {
+ throw new Exception('unserialize failed for key: '.$key);
+ }
+ return $data;
+ }
protected final function getTTL($etime) {
return $etime - time();
Modified: trunk/framework/Bee/Framework.php
===================================================================
--- trunk/framework/Bee/Framework.php 2014-02-17 12:35:01 UTC (rev 145)
+++ trunk/framework/Bee/Framework.php 2014-02-26 13:56:55 UTC (rev 146)
@@ -126,7 +126,10 @@
if(self::$productionMode) {
if(!is_array(self::$classFileMap)) {
- self::$classFileMap = Bee_Cache_Manager::retrieve(self::CLASS_FILE_CACHE_PREFIX);
+ try {
+ self::$classFileMap = Bee_Cache_Manager::retrieve(self::CLASS_FILE_CACHE_PREFIX);
+ } catch (Exception $e) {
+ }
if(!is_array(self::$classFileMap)) {
self::$classFileMap = array();
}
Modified: trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php
===================================================================
--- trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php 2014-02-17 12:35:01 UTC (rev 145)
+++ trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AnnotationBased.php 2014-02-26 13:56:55 UTC (rev 146)
@@ -70,7 +70,10 @@
$delegateClassName = get_class($this->getController()->getDelegate());
if(Bee_Framework::getProductionMode()) {
- $this->methodResolvers = Bee_Cache_Manager::retrieve(self::CACHE_KEY_PREFIX.$delegateClassName);
+ try {
+ $this->methodResolvers = Bee_Cache_Manager::retrieve(self::CACHE_KEY_PREFIX . $delegateClassName);
+ } catch (Exception $e) {
+ }
}
if(!$this->methodResolvers) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 12:35:13
|
Revision: 145
http://sourceforge.net/p/beeframework/code/145
Author: m_plomer
Date: 2014-02-17 12:35:01 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.23/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 12:14:48
|
Revision: 144
http://sourceforge.net/p/beeframework/code/144
Author: m_plomer
Date: 2014-02-17 12:14:37 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
- updated composer.json
Modified Paths:
--------------
trunk/framework/composer.json
Modified: trunk/framework/composer.json
===================================================================
--- trunk/framework/composer.json 2014-02-17 12:04:13 UTC (rev 143)
+++ trunk/framework/composer.json 2014-02-17 12:14:37 UTC (rev 144)
@@ -1,4 +1,10 @@
{
+ "repositories": [
+ {
+ "type": "pear",
+ "url": "pear.php.net"
+ }
+ ],
"name": "bee-framework/bee-framework",
"type": "library",
"description": "Bee Framework - PHP 5 DI/IoC application framework",
@@ -17,7 +23,8 @@
"require": {
"php": ">=5.3",
"niktux/addendum": "0.4.1",
- "apache/log4php": "2.3.0"
+ "apache/log4php": "~2.3@stable",
+ "pear-pear/I18N_UnicodeNormalizer": "*@stable"
},
"autoload": {
"psr-0": {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 12:04:14
|
Revision: 143
http://sourceforge.net/p/beeframework/code/143
Author: m_plomer
Date: 2014-02-17 12:04:13 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
Added Paths:
-----------
tags/0.9.22/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 12:03:28
|
Revision: 142
http://sourceforge.net/p/beeframework/code/142
Author: m_plomer
Date: 2014-02-17 12:03:22 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
- unicode normalizer -> composer compatibility
Modified Paths:
--------------
trunk/framework/Bee/Text/Normalization/PEARNormalizer.php
Modified: trunk/framework/Bee/Text/Normalization/PEARNormalizer.php
===================================================================
--- trunk/framework/Bee/Text/Normalization/PEARNormalizer.php 2014-02-17 12:03:07 UTC (rev 141)
+++ trunk/framework/Bee/Text/Normalization/PEARNormalizer.php 2014-02-17 12:03:22 UTC (rev 142)
@@ -26,7 +26,7 @@
private static $pearDataDir;
/**
- * @param mixed $pearDataDir
+ * @param string $pearDataDir
*/
public static function setPearDataDir($pearDataDir) {
self::$pearDataDir = $pearDataDir;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 12:03:11
|
Revision: 141
http://sourceforge.net/p/beeframework/code/141
Author: m_plomer
Date: 2014-02-17 12:03:07 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
- unicode normalizer -> composer compatibility
Modified Paths:
--------------
trunk/framework/Bee/Text/Normalization/PEARNormalizer.php
Modified: trunk/framework/Bee/Text/Normalization/PEARNormalizer.php
===================================================================
--- trunk/framework/Bee/Text/Normalization/PEARNormalizer.php 2014-02-17 11:58:28 UTC (rev 140)
+++ trunk/framework/Bee/Text/Normalization/PEARNormalizer.php 2014-02-17 12:03:07 UTC (rev 141)
@@ -28,7 +28,7 @@
/**
* @param mixed $pearDataDir
*/
- public static function setPearDataDir(mixed $pearDataDir) {
+ public static function setPearDataDir($pearDataDir) {
self::$pearDataDir = $pearDataDir;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 11:58:34
|
Revision: 140
http://sourceforge.net/p/beeframework/code/140
Author: m_plomer
Date: 2014-02-17 11:58:28 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
Added Paths:
-----------
tags/0.9.21/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 11:57:54
|
Revision: 139
http://sourceforge.net/p/beeframework/code/139
Author: m_plomer
Date: 2014-02-17 11:57:50 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
- unicode normalizer -> composer compatibility
Modified Paths:
--------------
trunk/composer.json
trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php
trunk/framework/Bee/Text/Normalization/PEARNormalizer.php
Modified: trunk/composer.json
===================================================================
--- trunk/composer.json 2014-02-17 11:30:30 UTC (rev 138)
+++ trunk/composer.json 2014-02-17 11:57:50 UTC (rev 139)
@@ -1,4 +1,14 @@
{
+ "repositories": [
+ {
+ "type": "composer",
+ "url": "http://dev.iter8.de/composer/"
+ },
+ {
+ "type": "pear",
+ "url": "pear.php.net"
+ }
+ ],
"name": "bee-framework/bee-framework",
"type": "library",
"description": "Bee Framework - PHP 5 DI/IoC application framework",
@@ -19,7 +29,8 @@
"doctrine/orm": "~2.4@RC",
"doctrine/doctrine1": "~1.2@stable",
"niktux/addendum": "0.4.1",
- "apache/log4php": "~2.3@stable"
+ "apache/log4php": "~2.3@stable",
+ "pear-pear/I18N_UnicodeNormalizer": "*@stable"
},
"require-dev": {
"smarty/smarty": "~3.1@stable",
Modified: trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php
===================================================================
--- trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php 2014-02-17 11:30:30 UTC (rev 138)
+++ trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php 2014-02-17 11:57:50 UTC (rev 139)
@@ -96,9 +96,9 @@
}
public function afterPropertiesSet() {
-// $this->doctrineManager->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
-// $this->doctrineManager->setAttribute(Doctrine::ATTR_AUTO_FREE_QUERY_OBJECTS, true);
-// $this->doctrineManager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
+// $this->doctrineManager->setAttribute(Doctrine_Core::ATTR_USE_DQL_CALLBACKS, true);
+// $this->doctrineManager->setAttribute(Doctrine_Core::ATTR_AUTO_FREE_QUERY_OBJECTS, true);
+// $this->doctrineManager->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true);
if($this->queryCacheDriver) {
$this->doctrineManager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $this->queryCacheDriver);
Modified: trunk/framework/Bee/Text/Normalization/PEARNormalizer.php
===================================================================
--- trunk/framework/Bee/Text/Normalization/PEARNormalizer.php 2014-02-17 11:30:30 UTC (rev 138)
+++ trunk/framework/Bee/Text/Normalization/PEARNormalizer.php 2014-02-17 11:57:50 UTC (rev 139)
@@ -23,7 +23,16 @@
class Bee_Text_Normalization_PEARNormalizer implements Bee_Text_Normalization_INormalizer {
+ private static $pearDataDir;
+
/**
+ * @param mixed $pearDataDir
+ */
+ public static function setPearDataDir(mixed $pearDataDir) {
+ self::$pearDataDir = $pearDataDir;
+ }
+
+ /**
* @var I18N_UnicodeNormalizer
*/
private $normalizer;
@@ -38,6 +47,6 @@
}
public function __construct() {
- $this->normalizer = new I18N_UnicodeNormalizer();
+ $this->normalizer = new I18N_UnicodeNormalizer(self::$pearDataDir);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 11:30:35
|
Revision: 138
http://sourceforge.net/p/beeframework/code/138
Author: m_plomer
Date: 2014-02-17 11:30:30 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
Added Paths:
-----------
tags/0.9.20/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-02-17 11:29:37
|
Revision: 137
http://sourceforge.net/p/beeframework/code/137
Author: m_plomer
Date: 2014-02-17 11:29:34 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
- Doctrine -> Doctrine_Core
Modified Paths:
--------------
trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php
Modified: trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php
===================================================================
--- trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php 2014-01-19 14:20:28 UTC (rev 136)
+++ trunk/framework/Bee/Persistence/Doctrine/ManagerAugmenter.php 2014-02-17 11:29:34 UTC (rev 137)
@@ -101,11 +101,11 @@
// $this->doctrineManager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
if($this->queryCacheDriver) {
- $this->doctrineManager->setAttribute(Doctrine::ATTR_QUERY_CACHE, $this->queryCacheDriver);
+ $this->doctrineManager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $this->queryCacheDriver);
}
if($this->resultCacheDriver) {
- $this->doctrineManager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $this->resultCacheDriver);
+ $this->doctrineManager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, $this->resultCacheDriver);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-01-19 14:20:31
|
Revision: 136
http://sourceforge.net/p/beeframework/code/136
Author: m_plomer
Date: 2014-01-19 14:20:28 +0000 (Sun, 19 Jan 2014)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.19/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2014-01-19 14:14:31
|
Revision: 135
http://sourceforge.net/p/beeframework/code/135
Author: m_plomer
Date: 2014-01-19 14:14:28 +0000 (Sun, 19 Jan 2014)
Log Message:
-----------
- removed old Potiscom dependencies
- added slug method to string utils
- some minor cleanup
Modified Paths:
--------------
trunk/framework/Bee/MVC/Model.php
trunk/framework/Bee/Security/Helper.php
trunk/framework/Bee/Utils/Strings.php
Modified: trunk/framework/Bee/MVC/Model.php
===================================================================
--- trunk/framework/Bee/MVC/Model.php 2013-11-26 06:51:53 UTC (rev 134)
+++ trunk/framework/Bee/MVC/Model.php 2014-01-19 14:14:28 UTC (rev 135)
@@ -36,8 +36,6 @@
self::$modelValues = array_merge(self::$modelValues, $values);
}
-
-
/**
* Add a single value to the model under the given key
*
@@ -48,8 +46,6 @@
self::$modelValues[$key] = $value;
}
-
-
/**
* Clear the model, removing all
*
Modified: trunk/framework/Bee/Security/Helper.php
===================================================================
--- trunk/framework/Bee/Security/Helper.php 2013-11-26 06:51:53 UTC (rev 134)
+++ trunk/framework/Bee/Security/Helper.php 2014-01-19 14:14:28 UTC (rev 135)
@@ -121,52 +121,7 @@
}
return $auth;
}
-
- /**
- * @param $identityName
- * @return mixed
- * @throws Bee_Security_Exception_Authentication
- */
- public static function getIdentity($identityName) {
- $auth = self::$userDetailsService->getGroupByName($identityName);
- if ($auth instanceof Potiscom_Auth_Doctrine_Group) {
- return $auth;
- }
- $auth = self::$userDetailsService->getUserByName($identityName);
- if ($auth instanceof Potiscom_Auth_Doctrine_User) {
- return $auth;
- }
- throw new Bee_Security_Exception_Authentication('Not authenticated');
- }
-
- /**
- * @param $identityName
- * @param $configAttribute
- * @param null $secureObject
- * @return bool
- */
- public static function checkAccessForIdentity($identityName, $configAttribute, $secureObject = null) {
- $identity = self::getIdentity($identityName);
- $auth = new Bee_Security_UsernamePasswordAuthenticationToken($username, $password);
- self::$accessDecisionManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute));
- return true;
- }
-
- /**
- * @param $identityName
- * @param $configAttribute
- * @param null $secureObject
- * @param null $returnedObject
- * @return mixed
- */
- public static function checkResultAccessForIdentity($identityName, $configAttribute, $secureObject = null, $returnedObject = null) {
- $auth = self::getIdentity($identityName);
- return self::$afterInvocationProviderManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject);
- }
-
}
class SEC extends Bee_Security_Helper {
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
Modified: trunk/framework/Bee/Utils/Strings.php
===================================================================
--- trunk/framework/Bee/Utils/Strings.php 2013-11-26 06:51:53 UTC (rev 134)
+++ trunk/framework/Bee/Utils/Strings.php 2014-01-19 14:14:28 UTC (rev 135)
@@ -23,6 +23,16 @@
*/
class Bee_Utils_Strings {
+ public static $DEFAULT_ASCII_REPLACEMENTS_TABLE = array(
+ 'ä' => 'ae',
+ 'ö' => 'oe',
+ 'ü' => 'ue',
+ 'Ä' => 'Ae',
+ 'Ö' => 'Oe',
+ 'Ü' => 'Ue',
+ 'ß' => 'ss'
+ );
+
/**
* Enter description here...
*
@@ -191,4 +201,26 @@
$sufTest = substr($string, (-strlen($suffix)));
return $sufTest === $string || $sufTest === false ? "" === $suffix : $sufTest === $suffix;
}
+
+ /**
+ * Creates ascii-slug from any string. Make sure iconv is installed and setLocale() is called before using this
+ * E.g. setlocale(LC_ALL, 'en_US.UTF8');
+ *
+ * @param $string
+ * @param array $table
+ * @param string $delimiter
+ * @param bool $toLowercase
+ *
+ * @return string
+ */
+ public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true) {
+ if (count($table)>0) {
+ $string = strtr($string, $table);
+ }
+ $ascii = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
+ $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $ascii);
+ $ascii = trim($ascii, '-');
+ $ascii = preg_replace("/[\/_|+ -]+/", $delimiter, $ascii);
+ return $toLowercase ? strtolower($ascii) : $ascii;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-26 06:51:55
|
Revision: 134
http://sourceforge.net/p/beeframework/code/134
Author: m_plomer
Date: 2013-11-26 06:51:53 +0000 (Tue, 26 Nov 2013)
Log Message:
-----------
- Bee_MVC_Model: added hasValue()
Modified Paths:
--------------
trunk/framework/Bee/MVC/Model.php
Modified: trunk/framework/Bee/MVC/Model.php
===================================================================
--- trunk/framework/Bee/MVC/Model.php 2013-11-22 23:34:27 UTC (rev 133)
+++ trunk/framework/Bee/MVC/Model.php 2013-11-26 06:51:53 UTC (rev 134)
@@ -62,6 +62,10 @@
return self::$modelValues[$key];
}
+ public static function hasValue($key) {
+ return array_key_exists($key, self::$modelValues);
+ }
+
public static function getModelValues() {
return self::$modelValues;
}
@@ -74,12 +78,14 @@
*/
class MODEL extends Bee_MVC_Model {
- public static function get($key) {
+ public static function get($key, $defaultValue=null) {
+ if (!is_null($defaultValue) && !Bee_MVC_Model::hasValue($key)) {
+ return $defaultValue;
+ }
return Bee_MVC_Model::getValue($key);
}
public static function getModel() {
return Bee_MVC_Model::getModelValues();
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-22 23:34:32
|
Revision: 133
http://sourceforge.net/p/beeframework/code/133
Author: m_plomer
Date: 2013-11-22 23:34:27 +0000 (Fri, 22 Nov 2013)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.18/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-22 15:36:12
|
Revision: 132
http://sourceforge.net/p/beeframework/code/132
Author: m_plomer
Date: 2013-11-22 15:36:09 +0000 (Fri, 22 Nov 2013)
Log Message:
-----------
- added smarty function for base path
Added Paths:
-----------
trunk/framework/resources/smarty/function.get_base_path.php
Added: trunk/framework/resources/smarty/function.get_base_path.php
===================================================================
--- trunk/framework/resources/smarty/function.get_base_path.php (rev 0)
+++ trunk/framework/resources/smarty/function.get_base_path.php 2013-11-22 15:36:09 UTC (rev 132)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * User: mp
+ * Date: 30.09.13
+ * Time: 23:20
+ *
+ *
+ */
+function smarty_function_get_base_path(array $params, Smarty_Internal_Template $template) {
+ $abs = array_key_exists('absolute', $params) && $params['absolute'];
+ $basePath = $abs ? Bee_Utils_Env::getAbsoluteBasePath() : Bee_Utils_Env::getBasePath();
+ return Bee_Utils_Strings::hasText($basePath) ? ($abs ? '' : '/') . $basePath : '';
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-09 13:58:16
|
Revision: 131
http://sourceforge.net/p/beeframework/code/131
Author: m_plomer
Date: 2013-11-09 13:58:13 +0000 (Sat, 09 Nov 2013)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.17/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-09 13:57:19
|
Revision: 130
http://sourceforge.net/p/beeframework/code/130
Author: m_plomer
Date: 2013-11-09 13:57:17 +0000 (Sat, 09 Nov 2013)
Log Message:
-----------
- HttpRequest: suppress Undefined index warnings when accessing request parameters
Modified Paths:
--------------
trunk/framework/Bee/MVC/HttpRequest.php
Modified: trunk/framework/Bee/MVC/HttpRequest.php
===================================================================
--- trunk/framework/Bee/MVC/HttpRequest.php 2013-11-08 23:23:24 UTC (rev 129)
+++ trunk/framework/Bee/MVC/HttpRequest.php 2013-11-09 13:57:17 UTC (rev 130)
@@ -122,7 +122,7 @@
// $val = $val[0];
// }
// return $val;
- return $this->parameters[$name];
+ return array_key_exists($name, $this->parameters) ? $this->parameters[$name] : null;
}
public function setParameter($name, $value) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-08 23:23:27
|
Revision: 129
http://sourceforge.net/p/beeframework/code/129
Author: m_plomer
Date: 2013-11-08 23:23:24 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.16/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-08 23:12:02
|
Revision: 128
http://sourceforge.net/p/beeframework/code/128
Author: m_plomer
Date: 2013-11-08 23:11:58 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
- Context_Abstract: added some more root exceptions that previously were lost
Modified Paths:
--------------
trunk/framework/Bee/Context/Abstract.php
Modified: trunk/framework/Bee/Context/Abstract.php
===================================================================
--- trunk/framework/Bee/Context/Abstract.php 2013-11-08 16:13:00 UTC (rev 127)
+++ trunk/framework/Bee/Context/Abstract.php 2013-11-08 23:11:58 UTC (rev 128)
@@ -161,7 +161,7 @@
}
}
catch (Exception $ex) {
- throw new Bee_Context_BeanCreationException($beanName, 'BeanPostProcessor before instantiation of bean failed - '.$ex->getMessage());
+ throw new Bee_Context_BeanCreationException($beanName, 'BeanPostProcessor before instantiation of bean failed - '.$ex->getMessage(), $ex);
}
return $this->doCreateBean($beanName, $beanDefinition);
}
@@ -259,7 +259,7 @@
try {
$this->invokeInitMethods($beanName, $wrappedBean, $beanDefinition);
} catch (Exception $ex) {
- throw new Bee_Context_BeanCreationException($beanName, 'Invocation of init method failed - '.$ex->getMessage());
+ throw new Bee_Context_BeanCreationException($beanName, 'Invocation of init method failed - '.$ex->getMessage(), $ex);
}
if (is_null($beanDefinition) || !$beanDefinition->isSynthetic()) {
@@ -455,7 +455,7 @@
try {
$beanWrapper->setPropertyValues($deepCopy);
} catch (Bee_Context_BeansException $ex) {
- throw new Bee_Context_BeanCreationException($beanName);
+ throw new Bee_Context_BeanCreationException($beanName, 'Error applying property values', $ex);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-08 16:13:04
|
Revision: 127
http://sourceforge.net/p/beeframework/code/127
Author: m_plomer
Date: 2013-11-08 16:13:00 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
- Context_Abstract: added root exception to been init exc
Modified Paths:
--------------
trunk/framework/Bee/Context/Abstract.php
Modified: trunk/framework/Bee/Context/Abstract.php
===================================================================
--- trunk/framework/Bee/Context/Abstract.php 2013-11-08 14:39:47 UTC (rev 126)
+++ trunk/framework/Bee/Context/Abstract.php 2013-11-08 16:13:00 UTC (rev 127)
@@ -210,7 +210,7 @@
if ($ex instanceof Bee_Context_BeanCreationException && $beanName === $ex->getBeanName()) {
throw $ex;
} else {
- throw new Bee_Context_BeanCreationException($beanName, 'Initialization of bean failed - '.$ex->getMessage());
+ throw new Bee_Context_BeanCreationException($beanName, 'Initialization of bean failed - '.$ex->getMessage(), $ex);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-08 14:39:50
|
Revision: 126
http://sourceforge.net/p/beeframework/code/126
Author: m_plomer
Date: 2013-11-08 14:39:47 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
- MVC: AntPathMatcher: allow null handler mappings
Modified Paths:
--------------
trunk/framework/Bee/Utils/AntPathMatcher.php
Modified: trunk/framework/Bee/Utils/AntPathMatcher.php
===================================================================
--- trunk/framework/Bee/Utils/AntPathMatcher.php 2013-11-07 17:19:15 UTC (rev 125)
+++ trunk/framework/Bee/Utils/AntPathMatcher.php 2013-11-08 14:39:47 UTC (rev 126)
@@ -394,18 +394,20 @@
* @param mixed $defaultValue
* @return mixed
*/
- public static function getElementByMatchingArrayKey($path, array $array, $defaultValue = null) {
+ public static function getElementByMatchingArrayKey($path, array $array = null, $defaultValue = null) {
$result = $defaultValue;
- if (array_key_exists($path, $array)) {
- // shortcut for direct path matches
- $result = $array[$path];
- } else {
- $matcher = new Bee_Utils_AntPathMatcher();
- foreach($array as $mapping => $element) {
- if($matcher->match($mapping, $path)) {
-// if(($matcher->isPattern($mapping) && $matcher->match($mapping, $pathInfo)) || Bee_Utils_Strings::startsWith($pathInfo, $mapping)) {
- $result = $element;
- break;
+ if(is_array($array)) {
+ if (array_key_exists($path, $array)) {
+ // shortcut for direct path matches
+ $result = $array[$path];
+ } else {
+ $matcher = new Bee_Utils_AntPathMatcher();
+ foreach($array as $mapping => $element) {
+ if($matcher->match($mapping, $path)) {
+ // if(($matcher->isPattern($mapping) && $matcher->match($mapping, $pathInfo)) || Bee_Utils_Strings::startsWith($pathInfo, $mapping)) {
+ $result = $element;
+ break;
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-07 17:19:17
|
Revision: 125
http://sourceforge.net/p/beeframework/code/125
Author: m_plomer
Date: 2013-11-07 17:19:15 +0000 (Thu, 07 Nov 2013)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.15/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-07 17:18:31
|
Revision: 124
http://sourceforge.net/p/beeframework/code/124
Author: m_plomer
Date: 2013-11-07 17:18:26 +0000 (Thu, 07 Nov 2013)
Log Message:
-----------
- MVC: IHandlerInterceptor: made $handler optional in postHandle() and afterCompletion()
Modified Paths:
--------------
trunk/framework/Bee/MVC/IHandlerInterceptor.php
trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php
trunk/framework/Bee/MVC/Interceptor/StripSlashes.php
Modified: trunk/framework/Bee/MVC/IHandlerInterceptor.php
===================================================================
--- trunk/framework/Bee/MVC/IHandlerInterceptor.php 2013-11-07 17:12:51 UTC (rev 123)
+++ trunk/framework/Bee/MVC/IHandlerInterceptor.php 2013-11-07 17:18:26 UTC (rev 124)
@@ -45,7 +45,7 @@
* @param Bee_MVC_ModelAndView $mav
* @return void
*/
- public function postHandle(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler, Bee_MVC_ModelAndView $mav);
+ public function postHandle(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler = null, Bee_MVC_ModelAndView $mav);
/**
@@ -56,7 +56,5 @@
* @param Exception $ex
* @return void
*/
- public function afterCompletion(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler, Exception $ex);
+ public function afterCompletion(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler = null, Exception $ex);
}
-
-?>
\ No newline at end of file
Modified: trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php
===================================================================
--- trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php 2013-11-07 17:12:51 UTC (rev 123)
+++ trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php 2013-11-07 17:18:26 UTC (rev 124)
@@ -46,14 +46,13 @@
- public function postHandle(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler, Bee_MVC_ModelAndView $mav) {
+ public function postHandle(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler = null, Bee_MVC_ModelAndView $mav) {
}
- public function afterCompletion(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler, Exception $ex) {
+ public function afterCompletion(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler = null, Exception $ex) {
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
Modified: trunk/framework/Bee/MVC/Interceptor/StripSlashes.php
===================================================================
--- trunk/framework/Bee/MVC/Interceptor/StripSlashes.php 2013-11-07 17:12:51 UTC (rev 123)
+++ trunk/framework/Bee/MVC/Interceptor/StripSlashes.php 2013-11-07 17:18:26 UTC (rev 124)
@@ -38,12 +38,11 @@
return $param;
}
- public function postHandle(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler, Bee_MVC_ModelAndView $mav) {
+ public function postHandle(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler = null, Bee_MVC_ModelAndView $mav) {
}
- public function afterCompletion(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler, Exception $ex) {
+ public function afterCompletion(Bee_MVC_IHttpRequest $request, Bee_MVC_IController $handler = null, Exception $ex) {
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-07 17:12:54
|
Revision: 123
http://sourceforge.net/p/beeframework/code/123
Author: m_plomer
Date: 2013-11-07 17:12:51 +0000 (Thu, 07 Nov 2013)
Log Message:
-----------
tagged latest changes
Added Paths:
-----------
tags/0.9.14/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <m_p...@us...> - 2013-11-07 17:11:42
|
Revision: 122
http://sourceforge.net/p/beeframework/code/122
Author: m_plomer
Date: 2013-11-07 17:11:37 +0000 (Thu, 07 Nov 2013)
Log Message:
-----------
- MVC: Dispatcher: fixed interceptor resolution on handler exception
- MVC: Dispatcher: added logging for some cases
Modified Paths:
--------------
trunk/framework/Bee/MVC/Dispatcher.php
trunk/framework/Bee/MVC/HandlerExecutionChain.php
trunk/framework/Bee/MVC/HandlerMapping/Abstract.php
trunk/framework/Bee/MVC/IHandlerMapping.php
Modified: trunk/framework/Bee/MVC/Dispatcher.php
===================================================================
--- trunk/framework/Bee/MVC/Dispatcher.php 2013-11-06 12:36:06 UTC (rev 121)
+++ trunk/framework/Bee/MVC/Dispatcher.php 2013-11-07 17:11:37 UTC (rev 122)
@@ -26,30 +26,45 @@
* controller bean for the curret request.</li>
* <li><b>viewResolver</b>: an instance of <code>Bee_MVC_IViewResolver</code> that is used to map view names returned by the back
* controllers to actual view implementations.</li>
- * </ul>
+ * </ul>
* <p/>
* Conceptually, this Dispatcher is based entirely on the implementation of the DispathcerServler in the
* {@link http://www.springframework.org Spring Framework}.
- * For additional information on the concepts, please refer to the chapter on Web MVC in the Spring documentation.
- *
+ * For additional information on the concepts, please refer to the chapter on Web MVC in the Spring documentation.
+ *
* @see Bee_IContext
* @see Bee_MVC_IHandlerMapping
* @see Bee_MVC_IViewResolver
- *
+ *
* @author Michael Plomer <mic...@it...>
* @author Benjamin Hartmann
*/
class Bee_MVC_Dispatcher implements Bee_MVC_IFilterChain {
-
+
const HANDLER_MAPPING_BEAN_NAME = 'handlerMapping';
-
+
const VIEW_RESOLVER_BEAN_NAME = 'viewResolver';
-
+
const FILTER_CHAIN_PROXY_NAME = 'filterChainProxy';
-
+
const HANDLER_EXCEPTION_RESOLVER_NAME = 'handlerExceptionResolver';
-
+
/**
+ * @var Logger
+ */
+ protected $log;
+
+ /**
+ * @return Logger
+ */
+ protected function getLog() {
+ if (!$this->log) {
+ $this->log = Logger::getLogger(get_class($this));
+ }
+ return $this->log;
+ }
+
+ /**
* The dispatcher responsible for the current request
*
* @var Bee_MVC_Dispatcher
@@ -60,30 +75,30 @@
* @var Bee_MVC_IHttpRequest
*/
private static $currentRequest = null;
-
+
/**
* The root context used by this dispatcher
*
* @var Bee_IContext
*/
private $context;
-
-
+
+
/**
* The handler mapping used by this dispatcher
*
* @var Bee_MVC_IHandlerMapping
*/
private $handlerMapping;
-
+
/**
* The view resolver used by this dispatcher
*
* @var Bee_MVC_IViewResolver
*/
private $viewResolver;
-
+
/**
* Enter description here...
*
@@ -92,7 +107,7 @@
private $filterChainProxy;
/**
- *
+ *
* @var Bee_MVC_IHandlerExceptionResolver
*/
private $handlerExceptionResolver;
@@ -108,10 +123,11 @@
}
/**
+ * @throws Bee_Exceptions_Base
* @return Bee_MVC_IHttpRequest
*/
public static function getCurrentRequest() {
- if(is_null(self::$currentRequest)) {
+ if (is_null(self::$currentRequest)) {
throw new Bee_Exceptions_Base('No request object constructed yet');
}
@@ -120,25 +136,25 @@
/**
* Allows to dispatch control to sub-controllers from within a current request. Intended to be used to include hierarchical structures
- * which must be also available as first-class handlers (e.g. for AJAX-based updates).
+ * which must be also available as first-class handlers (e.g. for AJAX-based updates).
*
* @param Bee_MVC_IHttpRequest $request
* @return void
*/
- public static function includeDispatch(Bee_MVC_IHttpRequest $request) {
+ public static function includeDispatch(Bee_MVC_IHttpRequest $request) {
Bee_Utils_Assert::notNull(self::$currentDispatcher, 'No current dispatcher set - create an instance of Bee_MVC_Dispatcher and use its \'dispatch()\' method instead of \'includeDispatch()\'');
Bee_Utils_Assert::notNull($request, 'Request object must not be null');
-
+
// @todo: maybe use the apache-only virtual() function if available?
self::$currentDispatcher->dispatchInternally($request);
}
-
+
/**
- *
+ *
* @throws Bee_Context_NoSuchBeanDefinitionException
* @throws Bee_Context_BeanNotOfRequiredTypeException
* @throws Bee_Context_BeansException
- *
+ *
* @param String $beanName
* @param String $requiredType
* @return Object
@@ -146,7 +162,7 @@
public static function getBeanFromDispatcherContext($beanName, $requiredType = null) {
return self::get()->getContext()->getBean($beanName, $requiredType);
}
-
+
/**
* Construct a new dispatcher based on the given context.
*
@@ -154,10 +170,10 @@
*/
public function __construct(Bee_IContext $context) {
$this->context = $context;
- $this->init();
+ $this->init();
}
-
+
/**
* Initializes this dispatcher.
*
@@ -170,16 +186,17 @@
try {
$this->filterChainProxy = $this->context->getBean(self::FILTER_CHAIN_PROXY_NAME, 'Bee_MVC_IFilter');
} catch (Bee_Context_NoSuchBeanDefinitionException $ex) {
- // @todo: log on INFO level: no filter chain proxy
+ $this->getLog()->info('no filter chain proxy configured');
}
try {
- $this->handlerExceptionResolver = $this->context->getBean(self::HANDLER_EXCEPTION_RESOLVER_NAME, 'Bee_MVC_IHandlerExceptionResolver');
+ $this->handlerExceptionResolver = $this->context->getBean(self::HANDLER_EXCEPTION_RESOLVER_NAME, 'Bee_MVC_IHandlerExceptionResolver');
} catch (Bee_Context_NoSuchBeanDefinitionException $ex) {
- // @todo: log on INFO level: no exception resolver
+ $this->getLog()->info('no exception resolver configured');
}
- if($this->context->containsBean(Bee_MVC_Session_DispatcherAdapter::SESSION_HANDLER_NAME)) {
+ if ($this->context->containsBean(Bee_MVC_Session_DispatcherAdapter::SESSION_HANDLER_NAME)) {
+ $this->getLog()->info('custom session handler configured, setting it as PHP session_set_save_handler()');
$sessionAdapter = new Bee_MVC_Session_DispatcherAdapter($this->context);
session_set_save_handler(
array(&$sessionAdapter, "open"),
@@ -191,15 +208,15 @@
);
}
}
-
+
/**
- *
+ *
* @return Bee_IContext
*/
protected function getContext() {
return $this->context;
}
-
+
/**
* Main dispatch method. Entry point into the whole request lifecycle of Bee MVC.
*
@@ -209,7 +226,7 @@
self::$currentDispatcher = $this;
self::$currentRequest = $this->buildRequestObject();
- if(!is_null($this->filterChainProxy)) {
+ if (!is_null($this->filterChainProxy)) {
$this->filterChainProxy->doFilter(self::$currentRequest, $this);
} else {
$this->doFilter(self::$currentRequest);
@@ -219,51 +236,62 @@
}
public function doFilter(Bee_MVC_IHttpRequest $request) {
- $this->dispatchInternally($request);
+ $this->dispatchInternally($request);
}
-
+
private function dispatchInternally(Bee_MVC_IHttpRequest $request) {
$handler = null;
try {
$mav = null;
+ $interceptors = array();
+ $handlerException = null;
try {
-
+
$mappedHandler = $this->handlerMapping->getHandler($request);
$interceptors = $mappedHandler->getInterceptors();
$handler = $mappedHandler->getHandler();
-
- $interceptorIndex = -1;
-
- $interceptors_length = count($interceptors);
- for ($i = 0; $i < $interceptors_length; $i++) {
+
+// $interceptorIndex = -1;
+
+ for ($i = 0; $i < count($interceptors); $i++) {
$interceptor = $interceptors[$i];
if (!$interceptor->preHandle($request, $handler)) {
- // $this->triggerAfterCompletion($handler, $interceptorIndex, $request, null);
+ // $this->triggerAfterCompletion($handler, $interceptorIndex, $request, null);
return;
}
- $interceptorIndex = $i;
+// $interceptorIndex = $i;
}
-
+
// @todo: introduce HandlerAdapter
$mav = $handler->handleRequest($request);
-
- } catch(Exception $e) {
+
+ } catch (Exception $e) {
+ $this->getLog()->warn('handler or interceptor exception caught, trying to resolve appropriate error view', $e);
// @todo: handle exceptions caused by handlers properly (i.e. as application level exceptions)
- if($this->handlerExceptionResolver) {
+ if ($this->handlerExceptionResolver) {
$mav = $this->handlerExceptionResolver->resolveException($request, $handler, $e);
}
-
- if(!$mav) {
+
+ if (!$mav) {
throw $e;
}
+
+ // got a view, make sure the rest of the request processing runs as intended (esp. post-handling)
+ $handlerException = $e;
}
- if($mav instanceof Bee_MVC_ModelAndView) {
+ if ($mav instanceof Bee_MVC_ModelAndView) {
$mav->addModelValue(Bee_MVC_Model::CURRENT_REQUEST_KEY, $request);
$this->resolveModelAndView($mav);
+ if(!is_null($handlerException) && !count($interceptors)) {
+ // We were unable to resolve a handler and its interceptors due to an exception being thrown along
+ // the way, but we have an error view. Assume the error view needs the interceptor post-handlers to
+ // run normally: fetch list of configured interceptors from handler mapping directly.
+ $interceptors = $this->handlerMapping->getInterceptors();
+ }
// Apply postHandle methods of registered interceptors.
- for ($i = $interceptors_length - 1; $i >= 0; $i--) {
+ for ($i = count($interceptors) - 1; $i >= 0; $i--) {
$interceptor = $interceptors[$i];
$interceptor->postHandle($request, $handler, $mav);
}
@@ -274,13 +302,13 @@
throw $e;
}
}
-
+
public function resolveModelAndView(Bee_MVC_ModelAndView $mav) {
$resolvedView = $this->viewResolver->resolveViewName($mav->getViewName());
$mav->setResolvedView($resolvedView);
- if($resolvedView instanceof Bee_MVC_View_Abstract) {
+ if ($resolvedView instanceof Bee_MVC_View_Abstract) {
$statics = $resolvedView->getStaticAttributes();
- if(!$statics) {
+ if (!$statics) {
$statics = array();
}
$model = array_merge($statics, $mav->getModel());
@@ -288,21 +316,21 @@
}
$this->resolveModelInternals($mav->getModel());
}
-
+
private function resolveModelInternals(array $model) {
foreach ($model as $modelElem) {
- if($modelElem instanceof Bee_MVC_ModelAndView) {
+ if ($modelElem instanceof Bee_MVC_ModelAndView) {
$this->resolveModelAndView($modelElem);
- } else if(is_array($modelElem)) {
+ } else if (is_array($modelElem)) {
$this->resolveModelInternals($modelElem);
}
}
}
-
+
/**
* Enter description here...
*
- * @return _BeeHttpRequest
+ * @return Bee_MVC_HttpRequest
*/
private function buildRequestObject() {
return new Bee_MVC_HttpRequest();
@@ -314,9 +342,9 @@
self::includeDispatch(Bee_MVC_HttpRequest::constructRequest(MODEL::get(MODEL::CURRENT_REQUEST_KEY), $pathInfo, $params, $method));
}
- public static function subDispatchFromModel($pathInfo, array $modelKeys = null, $method=null) {
+ public static function subDispatchFromModel($pathInfo, array $modelKeys = null, $method = null) {
$params = MODEL::getModel();
- if(is_array($modelKeys)) {
+ if (is_array($modelKeys)) {
$params = array_intersect_key($params, array_flip($modelKeys));
}
self::includeDispatch(Bee_MVC_HttpRequest::constructRequest(MODEL::get(MODEL::CURRENT_REQUEST_KEY), $pathInfo, $params, $method));
Modified: trunk/framework/Bee/MVC/HandlerExecutionChain.php
===================================================================
--- trunk/framework/Bee/MVC/HandlerExecutionChain.php 2013-11-06 12:36:06 UTC (rev 121)
+++ trunk/framework/Bee/MVC/HandlerExecutionChain.php 2013-11-07 17:11:37 UTC (rev 122)
@@ -29,17 +29,14 @@
* @var Bee_MVC_IController
*/
private $handler;
-
-
-
+
/**
* Enter description here...
*
- * @var array
+ * @var Bee_MVC_IHandlerInterceptor[]
*/
private $interceptors = array();
-
/**
* Enter description here...
*
@@ -49,9 +46,7 @@
public function __construct(Bee_MVC_IController $handler) {
$this->handler = $handler;
}
-
-
-
+
/**
* Enter description here...
*
@@ -61,9 +56,7 @@
public function addInterceptor(Bee_MVC_IHandlerInterceptor $interceptor) {
array_push($this->interceptors, $interceptor);
}
-
-
-
+
/**
* Enter description here...
*
@@ -73,8 +66,7 @@
public function addInterceptors(array $interceptors) {
$this->interceptors = array_merge($this->interceptors, $interceptors);
}
-
-
+
/**
* Enter description here...
*
@@ -83,9 +75,7 @@
public function getHandler() {
return $this->handler;
}
-
-
-
+
/**
* Enter description here...
*
Modified: trunk/framework/Bee/MVC/HandlerMapping/Abstract.php
===================================================================
--- trunk/framework/Bee/MVC/HandlerMapping/Abstract.php 2013-11-06 12:36:06 UTC (rev 121)
+++ trunk/framework/Bee/MVC/HandlerMapping/Abstract.php 2013-11-07 17:11:37 UTC (rev 122)
@@ -40,7 +40,7 @@
/**
* Enter description here...
*
- * @var array
+ * @var Bee_MVC_IHandlerInterceptor[]
*/
private $interceptors = array();
@@ -70,7 +70,7 @@
/**
* Enter description here...
*
- * @param array $interceptors
+ * @param Bee_MVC_IHandlerInterceptor[] $interceptors
*/
public function setInterceptors(array $interceptors) {
$this->interceptors = $interceptors;
@@ -79,12 +79,17 @@
/**
* Enter description here...
*
- * @return array
+ * @return Bee_MVC_IHandlerInterceptor[]
*/
public function getInterceptors() {
return $this->interceptors;
}
+ /**
+ * @param Bee_MVC_IHttpRequest $request
+ * @return Bee_MVC_HandlerExecutionChain
+ * @throws Exception
+ */
public function getHandler(Bee_MVC_IHttpRequest $request) {
$controllerBeanName = $this->getControllerBeanName($request);
$handlerBean = is_string($controllerBeanName) ?
@@ -100,5 +105,10 @@
return $hec;
}
+ /**
+ * Resolves the actual controller bean name (may also return a controller instance directly)
+ * @param Bee_MVC_IHttpRequest $request
+ * @return mixed
+ */
protected abstract function getControllerBeanName(Bee_MVC_IHttpRequest $request);
}
\ No newline at end of file
Modified: trunk/framework/Bee/MVC/IHandlerMapping.php
===================================================================
--- trunk/framework/Bee/MVC/IHandlerMapping.php 2013-11-06 12:36:06 UTC (rev 121)
+++ trunk/framework/Bee/MVC/IHandlerMapping.php 2013-11-07 17:11:37 UTC (rev 122)
@@ -24,20 +24,23 @@
* @author Benjamin Hartmann
*/
interface Bee_MVC_IHandlerMapping {
-
-
+
/**
* Based on the current request object, returns a handler execution chain, containing the back controller to be used, as well as any
* interceptors applicable to this request.
*
- * @param Bee_MVC_HttpRequest $request
+ * @param Bee_MVC_HttpRequest|Bee_MVC_IHttpRequest $request
* @return Bee_MVC_HandlerExecutionChain
- *
+ *
* @see Bee_MVC_IController
* @see Bee_MVC_IHandlerInterceptor
* @see Bee_MVC_HandlerExecutionChain
*/
public function getHandler(Bee_MVC_IHttpRequest $request);
-}
-?>
\ No newline at end of file
+ /**
+ * Get all configured interceptors
+ * @return Bee_MVC_IHandlerInterceptor[]
+ */
+ public function getInterceptors();
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|