[Beeframework-svn] SF.net SVN: beeframework:[186] trunk/framework/Bee
Brought to you by:
b_hartmann,
m_plomer
|
From: <m_p...@us...> - 2014-07-23 18:12:51
|
Revision: 186
http://sourceforge.net/p/beeframework/code/186
Author: m_plomer
Date: 2014-07-23 18:12:43 +0000 (Wed, 23 Jul 2014)
Log Message:
-----------
- MVC: fixed type hint detection for types from same namespace as controller delegate
- MVC: (temporarily) disabled caching of MethodInvocators in production mode due to non-serializability of ReflectionClass instances (TODO!!)
Modified Paths:
--------------
trunk/framework/Bee/MVC/Controller/Multiaction/AbstractAnnotationBasedResolver.php
trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php
trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/Inject.php
Modified: trunk/framework/Bee/MVC/Controller/Multiaction/AbstractAnnotationBasedResolver.php
===================================================================
--- trunk/framework/Bee/MVC/Controller/Multiaction/AbstractAnnotationBasedResolver.php 2014-07-23 12:37:06 UTC (rev 185)
+++ trunk/framework/Bee/MVC/Controller/Multiaction/AbstractAnnotationBasedResolver.php 2014-07-23 18:12:43 UTC (rev 186)
@@ -102,13 +102,13 @@
if (!$this->delegates) {
$delegateClassName = get_class($this->getController()->getDelegate());
- if (Bee_Framework::getProductionMode()) {
- try {
- $this->delegates = Bee_Cache_Manager::retrieve(self::CACHE_KEY_PREFIX . $delegateClassName);
- } catch (Exception $e) {
- $this->getLog()->debug('No cached delegate resolvers for delegate "' . $delegateClassName . '" found, annotation parsing required');
- }
- }
+// if (Bee_Framework::getProductionMode()) {
+// try {
+// $this->delegates = Bee_Cache_Manager::retrieve(self::CACHE_KEY_PREFIX . $delegateClassName);
+// } catch (Exception $e) {
+// $this->getLog()->debug('No cached delegate resolvers for delegate "' . $delegateClassName . '" found, annotation parsing required');
+// }
+// }
if (!$this->delegates) {
$classReflector = new ReflectionAnnotatedClass($delegateClassName);
@@ -141,9 +141,9 @@
}
}
- if (Bee_Framework::getProductionMode()) {
- Bee_Cache_Manager::store(self::CACHE_KEY_PREFIX . $delegateClassName, $this->delegates);
- }
+// if (Bee_Framework::getProductionMode()) {
+// Bee_Cache_Manager::store(self::CACHE_KEY_PREFIX . $delegateClassName, $this->delegates);
+// }
}
}
Modified: trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php
===================================================================
--- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php 2014-07-23 12:37:06 UTC (rev 185)
+++ trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php 2014-07-23 18:12:43 UTC (rev 186)
@@ -3,6 +3,7 @@
namespace Bee\MVC\Controller\Multiaction\HandlerMethodInvocator;
use Bee\Utils\ITypeDefinitions;
+use Bee_Utils_Types;
use ReflectionClass;
use ReflectionMethod;
@@ -104,12 +105,15 @@
*/
protected static function getDocBlockTypeHints(ReflectionMethod $method) {
$importMap = self::getImportMap($method->getDeclaringClass());
+ $namespace = $method->getDeclaringClass()->getNamespaceName();
$matches = array();
preg_match_all(self::DOCBLOCK_PARAM_TYPE_HINT_MATCH, $method->getDocComment(), $matches);
$types = $matches[1];
- array_walk($types, function (&$value) use ($importMap) {
+ array_walk($types, function (&$value) use ($importMap, $namespace) {
if (array_key_exists($value, $importMap)) {
$value = $importMap[$value];
+ } else if(!Bee_Utils_Types::isPrimitive($value) && !class_exists($value) && !interface_exists($value)) {
+ $value = $namespace . '\\' . $value;
}
});
return array_combine($matches[2], $types);
Modified: trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/Inject.php
===================================================================
--- trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/Inject.php 2014-07-23 12:37:06 UTC (rev 185)
+++ trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/Inject.php 2014-07-23 18:12:43 UTC (rev 186)
@@ -1,7 +1,7 @@
<?php
-
namespace Bee\Persistence\Doctrine2\BeanInjection;
+use Doctrine\Common\Annotations\Annotation;
/**
* Class Inject
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|