[TASK] Rename Reflection/Service to Reflection/ReflectionService
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 9 Nov 2012 07:20:35 +0000 (08:20 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Wed, 14 Nov 2012 23:33:23 +0000 (00:33 +0100)
This is part of the code cleanup.

Change-Id: I1d9ff99b565e279110ee8c6e1cff8ab6a47566f5
Resolves: #42808
Releases: 6.0
Reviewed-on: http://review.typo3.org/16341
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
31 files changed:
typo3/sysext/extbase/Classes/Core/Bootstrap.php
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php
typo3/sysext/extbase/Classes/Mvc/Cli/RequestBuilder.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php
typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php
typo3/sysext/extbase/Classes/Mvc/Dispatcher.php
typo3/sysext/extbase/Classes/Mvc/RequestHandlerResolver.php
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Property/Mapper.php
typo3/sysext/extbase/Classes/Property/TypeConverter/PersistentObjectConverter.php
typo3/sysext/extbase/Classes/Reflection/ReflectionService.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Reflection/Service.php [deleted file]
typo3/sysext/extbase/Classes/Scheduler/FieldProvider.php
typo3/sysext/extbase/Classes/Scheduler/TaskExecutor.php
typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Migrations/Code/ClassAliasMap.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/RequestBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ActionControllerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/ArgumentTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Mapper/DataMapFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Mapper/DataMapperTest.php
typo3/sysext/extbase/Tests/Unit/Property/MapperTest.php
typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/ServiceTest.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Validation/ValidatorResolverTest.php

index 39e84c6..022182f 100644 (file)
@@ -66,7 +66,7 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface {
        protected $cacheManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -166,7 +166,7 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface {
         * @see initialize()
         */
        protected function initializeReflection() {
-               $this->reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $this->reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $this->reflectionService->setDataCache($this->cacheManager->getCache('extbase_reflection'));
                if (!$this->reflectionService->isInitialized()) {
                        $this->reflectionService->initialize();
index 25517a3..25d9753 100644 (file)
@@ -59,7 +59,7 @@ class Command {
        /**
         * Reflection service
         *
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        private $reflectionService;
 
@@ -89,9 +89,9 @@ class Command {
        }
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService Reflection service
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService Reflection service
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index bb4c4ec..fc46342 100644 (file)
@@ -37,7 +37,7 @@ class RequestBuilder {
        protected $objectManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -55,10 +55,10 @@ class RequestBuilder {
        }
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index 56cc19f..19f5df2 100644 (file)
@@ -35,7 +35,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Controller;
 class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractController {
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -98,10 +98,10 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
        protected $errorMethodName = 'errorAction';
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index a4df3dc..38c4ced 100644 (file)
@@ -75,7 +75,7 @@ class Argument {
        protected $propertyMappingConfiguration;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -226,10 +226,10 @@ class Argument {
        }
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
                // Check for classnames (which have at least one underscore or backslash)
                $this->dataTypeClassSchema = strpbrk($this->dataType, '_\\') !== FALSE ? $this->reflectionService->getClassSchema($this->dataType) : NULL;
index 97bef8b..cbbd524 100644 (file)
@@ -55,7 +55,7 @@ class CommandController implements \TYPO3\CMS\Extbase\Mvc\Controller\CommandCont
        protected $commandMethodName = '';
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -65,10 +65,10 @@ class CommandController implements \TYPO3\CMS\Extbase\Mvc\Controller\CommandCont
        protected $objectManager;
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index 5ba2147..43006c8 100644 (file)
@@ -39,7 +39,7 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface {
        protected $objectManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -65,10 +65,10 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Injects the Reflection Service
         *
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index e149016..e312f50 100644 (file)
@@ -38,7 +38,7 @@ class RequestHandlerResolver {
        protected $objectManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -60,10 +60,10 @@ class RequestHandlerResolver {
        /**
         * Injects the reflection service
         *
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index bd9e4d5..fc3c167 100644 (file)
@@ -54,7 +54,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        protected $identityMap;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -154,10 +154,10 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        /**
         * Injects the Reflection Service
         *
-        * @param \TYPO3\CMS\Extbase\Reflection\Service
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
@@ -227,7 +227,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        /**
         * Returns the reflection service
         *
-        * @return \TYPO3\CMS\Extbase\Reflection\Service
+        * @return \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        public function getReflectionService() {
                return $this->reflectionService;
index 5308506..f92e36b 100644 (file)
@@ -32,7 +32,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Mapper;
 class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface {
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -59,10 +59,10 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Injects the reflection service
         *
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index b377349..5c3bc42 100644 (file)
@@ -37,7 +37,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
        protected $identityMap;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -110,10 +110,10 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Injects the Reflection Service
         *
-        * @param \TYPO3\CMS\Extbase\Reflection\Service
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index e3a7ebd..d8f8490 100644 (file)
@@ -65,7 +65,7 @@ class Mapper implements \TYPO3\CMS\Core\SingletonInterface {
        protected $validatorResolver;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -109,10 +109,10 @@ class Mapper implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index 9b4d7bd..147ca27 100644 (file)
@@ -66,7 +66,7 @@ class PersistentObjectConverter extends \TYPO3\CMS\Extbase\Property\TypeConverte
        protected $persistenceManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -87,10 +87,10 @@ class PersistentObjectConverter extends \TYPO3\CMS\Extbase\Property\TypeConverte
        }
 
        /**
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
diff --git a/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php b/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php
new file mode 100644 (file)
index 0000000..05b74b9
--- /dev/null
@@ -0,0 +1,558 @@
+<?php
+namespace TYPO3\CMS\Extbase\Reflection;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * A backport of the FLOW3 reflection service for aquiring reflection based information.
+ * Most of the code is based on the FLOW3 reflection service.
+ *
+ * @api
+ */
+class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
+
+       /**
+        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+        */
+       protected $objectManager;
+
+       /**
+        * Whether this service has been initialized.
+        *
+        * @var boolean
+        */
+       protected $initialized = FALSE;
+
+       /**
+        * @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
+        */
+       protected $dataCache;
+
+       /**
+        * Whether class alterations should be detected on each initialization.
+        *
+        * @var boolean
+        */
+       protected $detectClassChanges = FALSE;
+
+       /**
+        * All available class names to consider. Class name = key, value is the
+        * UNIX timestamp the class was reflected.
+        *
+        * @var array
+        */
+       protected $reflectedClassNames = array();
+
+       /**
+        * Array of tags and the names of classes which are tagged with them.
+        *
+        * @var array
+        */
+       protected $taggedClasses = array();
+
+       /**
+        * Array of class names and their tags and values.
+        *
+        * @var array
+        */
+       protected $classTagsValues = array();
+
+       /**
+        * Array of class names, method names and their tags and values.
+        *
+        * @var array
+        */
+       protected $methodTagsValues = array();
+
+       /**
+        * Array of class names, method names, their parameters and additional
+        * information about the parameters.
+        *
+        * @var array
+        */
+       protected $methodParameters = array();
+
+       /**
+        * Array of class names and names of their properties.
+        *
+        * @var array
+        */
+       protected $classPropertyNames = array();
+
+       /**
+        * Array of class names, property names and their tags and values.
+        *
+        * @var array
+        */
+       protected $propertyTagsValues = array();
+
+       /**
+        * List of tags which are ignored while reflecting class and method annotations.
+        *
+        * @var array
+        */
+       protected $ignoredTags = array('package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const');
+
+       /**
+        * Indicates whether the Reflection cache needs to be updated.
+        *
+        * This flag needs to be set as soon as new Reflection information was
+        * created.
+        *
+        * @see reflectClass()
+        * @see getMethodReflection()
+        * @var boolean
+        */
+       protected $dataCacheNeedsUpdate = FALSE;
+
+       /**
+        * Local cache for Class schemata
+        *
+        * @var array
+        */
+       protected $classSchemata = array();
+
+       /**
+        * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
+        * @var string
+        */
+       protected $cacheIdentifier;
+
+       /**
+        * @var array
+        */
+       protected $methodReflections;
+
+       /**
+        * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
+        * @return void
+        */
+       public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
+               $this->objectManager = $objectManager;
+       }
+
+       /**
+        * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
+        * Sets the data cache.
+        *
+        * The cache must be set before initializing the Reflection Service.
+        *
+        * @param \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache Cache for the Reflection service
+        * @return void
+        */
+       public function setDataCache(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache) {
+               $this->dataCache = $dataCache;
+       }
+
+       /**
+        * Initializes this service
+        *
+        * @throws Exception
+        * @return void
+        */
+       public function initialize() {
+               if ($this->initialized) {
+                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('The Reflection Service can only be initialized once.', 1232044696);
+               }
+               $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
+               $this->cacheIdentifier = 'ReflectionData_' . $frameworkConfiguration['extensionName'];
+               $this->loadFromCache();
+               $this->initialized = TRUE;
+       }
+
+       /**
+        * Returns whether the Reflection Service is initialized.
+        *
+        * @return boolean true if the Reflection Service is initialized, otherwise false
+        */
+       public function isInitialized() {
+               return $this->initialized;
+       }
+
+       /**
+        * Shuts the Reflection Service down.
+        *
+        * @return void
+        */
+       public function shutdown() {
+               if ($this->dataCacheNeedsUpdate) {
+                       $this->saveToCache();
+               }
+               $this->initialized = FALSE;
+       }
+
+       /**
+        * Returns the names of all properties of the specified class
+        *
+        * @param string $className Name of the class to return the property names of
+        * @return array An array of property names or an empty array if none exist
+        */
+       public function getClassPropertyNames($className) {
+               if (!isset($this->reflectedClassNames[$className])) {
+                       $this->reflectClass($className);
+               }
+               return isset($this->classPropertyNames[$className]) ? $this->classPropertyNames[$className] : array();
+       }
+
+       /**
+        * Returns the class schema for the given class
+        *
+        * @param mixed $classNameOrObject The class name or an object
+        * @return \TYPO3\CMS\Extbase\Reflection\ClassSchema
+        * @author Karsten Dambekalns <karsten@typo3.org>
+        */
+       public function getClassSchema($classNameOrObject) {
+               $className = is_object($classNameOrObject) ? get_class($classNameOrObject) : $classNameOrObject;
+               if (isset($this->classSchemata[$className])) {
+                       return $this->classSchemata[$className];
+               } else {
+                       return $this->buildClassSchema($className);
+               }
+       }
+
+       /**
+        * Returns all tags and their values the specified method is tagged with
+        *
+        * @param string $className Name of the class containing the method
+        * @param string $methodName Name of the method to return the tags and values of
+        * @return array An array of tags and their values or an empty array of no tags were found
+        */
+       public function getMethodTagsValues($className, $methodName) {
+               if (!isset($this->methodTagsValues[$className][$methodName])) {
+                       $this->methodTagsValues[$className][$methodName] = array();
+                       $method = $this->getMethodReflection($className, $methodName);
+                       foreach ($method->getTagsValues() as $tag => $values) {
+                               if (array_search($tag, $this->ignoredTags) === FALSE) {
+                                       $this->methodTagsValues[$className][$methodName][$tag] = $values;
+                               }
+                       }
+               }
+               return $this->methodTagsValues[$className][$methodName];
+       }
+
+       /**
+        * Returns an array of parameters of the given method. Each entry contains
+        * additional information about the parameter position, type hint etc.
+        *
+        * @param string $className Name of the class containing the method
+        * @param string $methodName Name of the method to return parameter information of
+        * @return array An array of parameter names and additional information or an empty array of no parameters were found
+        */
+       public function getMethodParameters($className, $methodName) {
+               if (!isset($this->methodParameters[$className][$methodName])) {
+                       $method = $this->getMethodReflection($className, $methodName);
+                       $this->methodParameters[$className][$methodName] = array();
+                       foreach ($method->getParameters() as $parameterPosition => $parameter) {
+                               $this->methodParameters[$className][$methodName][$parameter->getName()] = $this->convertParameterReflectionToArray($parameter, $parameterPosition, $method);
+                       }
+               }
+               return $this->methodParameters[$className][$methodName];
+       }
+
+       /**
+        * Returns all tags and their values the specified class property is tagged with
+        *
+        * @param string $className Name of the class containing the property
+        * @param string $propertyName Name of the property to return the tags and values of
+        * @return array An array of tags and their values or an empty array of no tags were found
+        */
+       public function getPropertyTagsValues($className, $propertyName) {
+               if (!isset($this->reflectedClassNames[$className])) {
+                       $this->reflectClass($className);
+               }
+               if (!isset($this->propertyTagsValues[$className])) {
+                       return array();
+               }
+               return isset($this->propertyTagsValues[$className][$propertyName]) ? $this->propertyTagsValues[$className][$propertyName] : array();
+       }
+
+       /**
+        * Returns the values of the specified class property tag
+        *
+        * @param string $className Name of the class containing the property
+        * @param string $propertyName Name of the tagged property
+        * @param string $tag Tag to return the values of
+        * @return array An array of values or an empty array if the tag was not found
+        * @author Robert Lemke <robert@typo3.org>
+        * @api
+        */
+       public function getPropertyTagValues($className, $propertyName, $tag) {
+               if (!isset($this->reflectedClassNames[$className])) {
+                       $this->reflectClass($className);
+               }
+               if (!isset($this->propertyTagsValues[$className][$propertyName])) {
+                       return array();
+               }
+               return isset($this->propertyTagsValues[$className][$propertyName][$tag]) ? $this->propertyTagsValues[$className][$propertyName][$tag] : array();
+       }
+
+       /**
+        * Tells if the specified class is known to this reflection service and
+        * reflection information is available.
+        *
+        * @param string $className Name of the class
+        * @return boolean If the class is reflected by this service
+        * @author Robert Lemke <robert@typo3.org>
+        * @api
+        */
+       public function isClassReflected($className) {
+               return isset($this->reflectedClassNames[$className]);
+       }
+
+       /**
+        * Tells if the specified class is tagged with the given tag
+        *
+        * @param string $className Name of the class
+        * @param string $tag Tag to check for
+        * @return boolean TRUE if the class is tagged with $tag, otherwise FALSE
+        * @author Robert Lemke <robert@typo3.org>
+        * @api
+        */
+       public function isClassTaggedWith($className, $tag) {
+               if ($this->initialized === FALSE) {
+                       return FALSE;
+               }
+               if (!isset($this->reflectedClassNames[$className])) {
+                       $this->reflectClass($className);
+               }
+               if (!isset($this->classTagsValues[$className])) {
+                       return FALSE;
+               }
+               return isset($this->classTagsValues[$className][$tag]);
+       }
+
+       /**
+        * Tells if the specified class property is tagged with the given tag
+        *
+        * @param string $className Name of the class
+        * @param string $propertyName Name of the property
+        * @param string $tag Tag to check for
+        * @return boolean TRUE if the class property is tagged with $tag, otherwise FALSE
+        * @author Robert Lemke <robert@typo3.org>
+        * @api
+        */
+       public function isPropertyTaggedWith($className, $propertyName, $tag) {
+               if (!isset($this->reflectedClassNames[$className])) {
+                       $this->reflectClass($className);
+               }
+               if (!isset($this->propertyTagsValues[$className])) {
+                       return FALSE;
+               }
+               if (!isset($this->propertyTagsValues[$className][$propertyName])) {
+                       return FALSE;
+               }
+               return isset($this->propertyTagsValues[$className][$propertyName][$tag]);
+       }
+
+       /**
+        * Reflects the given class and stores the results in this service's properties.
+        *
+        * @param string $className Full qualified name of the class to reflect
+        * @return void
+        */
+       protected function reflectClass($className) {
+               $class = new \TYPO3\CMS\Extbase\Reflection\ClassReflection($className);
+               $this->reflectedClassNames[$className] = time();
+               foreach ($class->getTagsValues() as $tag => $values) {
+                       if (array_search($tag, $this->ignoredTags) === FALSE) {
+                               $this->taggedClasses[$tag][] = $className;
+                               $this->classTagsValues[$className][$tag] = $values;
+                       }
+               }
+               foreach ($class->getProperties() as $property) {
+                       $propertyName = $property->getName();
+                       $this->classPropertyNames[$className][] = $propertyName;
+                       foreach ($property->getTagsValues() as $tag => $values) {
+                               if (array_search($tag, $this->ignoredTags) === FALSE) {
+                                       $this->propertyTagsValues[$className][$propertyName][$tag] = $values;
+                               }
+                       }
+               }
+               foreach ($class->getMethods() as $method) {
+                       $methodName = $method->getName();
+                       foreach ($method->getTagsValues() as $tag => $values) {
+                               if (array_search($tag, $this->ignoredTags) === FALSE) {
+                                       $this->methodTagsValues[$className][$methodName][$tag] = $values;
+                               }
+                       }
+                       foreach ($method->getParameters() as $parameterPosition => $parameter) {
+                               $this->methodParameters[$className][$methodName][$parameter->getName()] = $this->convertParameterReflectionToArray($parameter, $parameterPosition, $method);
+                       }
+               }
+               ksort($this->reflectedClassNames);
+               $this->dataCacheNeedsUpdate = TRUE;
+       }
+
+       /**
+        * Builds class schemata from classes annotated as entities or value objects
+        *
+        * @param string $className
+        * @throws Exception\UnknownClassException
+        * @return \TYPO3\CMS\Extbase\Reflection\ClassSchema The class schema
+        */
+       protected function buildClassSchema($className) {
+               if (!class_exists($className)) {
+                       throw new \TYPO3\CMS\Extbase\Reflection\Exception\UnknownClassException('The classname "' . $className . '" was not found and thus can not be reflected.', 1278450972);
+               }
+               $classSchema = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', $className);
+               if (is_subclass_of($className, 'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity')) {
+                       $classSchema->setModelType(\TYPO3\CMS\Extbase\Reflection\ClassSchema::MODELTYPE_ENTITY);
+                       if (strpos($className, '\\') !== FALSE) {
+                               $possibleRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', $className) . 'Repository';
+                       } else {
+                               $possibleRepositoryClassName = str_replace('_Model_', '_Repository_', $className) . 'Repository';
+                       }
+                       if (class_exists($possibleRepositoryClassName)) {
+                               $classSchema->setAggregateRoot(TRUE);
+                       }
+               } elseif (is_subclass_of($className, 'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractValueObject')) {
+                       $classSchema->setModelType(\TYPO3\CMS\Extbase\Reflection\ClassSchema::MODELTYPE_VALUEOBJECT);
+               } else {
+                       return NULL;
+               }
+               foreach ($this->getClassPropertyNames($className) as $propertyName) {
+                       if (!$this->isPropertyTaggedWith($className, $propertyName, 'transient') && $this->isPropertyTaggedWith($className, $propertyName, 'var')) {
+                               $cascadeTagValues = $this->getPropertyTagValues($className, $propertyName, 'cascade');
+                               $classSchema->addProperty($propertyName, implode(' ', $this->getPropertyTagValues($className, $propertyName, 'var')), $this->isPropertyTaggedWith($className, $propertyName, 'lazy'), $cascadeTagValues[0]);
+                       }
+                       if ($this->isPropertyTaggedWith($className, $propertyName, 'uuid')) {
+                               $classSchema->setUuidPropertyName($propertyName);
+                       }
+                       if ($this->isPropertyTaggedWith($className, $propertyName, 'identity')) {
+                               $classSchema->markAsIdentityProperty($propertyName);
+                       }
+               }
+               $this->classSchemata[$className] = $classSchema;
+               $this->dataCacheNeedsUpdate = TRUE;
+               return $classSchema;
+       }
+
+       /**
+        * Converts the given parameter reflection into an information array
+        *
+        * @param \ReflectionParameter $parameter The parameter to reflect
+        * @param integer $parameterPosition
+        * @param \ReflectionMethod|NULL $method
+        * @return array Parameter information array
+        */
+       protected function convertParameterReflectionToArray(\ReflectionParameter $parameter, $parameterPosition, \ReflectionMethod $method = NULL) {
+               $parameterInformation = array(
+                       'position' => $parameterPosition,
+                       'byReference' => $parameter->isPassedByReference() ? TRUE : FALSE,
+                       'array' => $parameter->isArray() ? TRUE : FALSE,
+                       'optional' => $parameter->isOptional() ? TRUE : FALSE,
+                       'allowsNull' => $parameter->allowsNull() ? TRUE : FALSE
+               );
+               $parameterClass = $parameter->getClass();
+               $parameterInformation['class'] = $parameterClass !== NULL ? $parameterClass->getName() : NULL;
+               if ($parameter->isDefaultValueAvailable()) {
+                       $parameterInformation['defaultValue'] = $parameter->getDefaultValue();
+               }
+               if ($parameterClass !== NULL) {
+                       $parameterInformation['type'] = $parameterClass->getName();
+               } elseif ($method !== NULL) {
+                       $methodTagsAndValues = $this->getMethodTagsValues($method->getDeclaringClass()->getName(), $method->getName());
+                       if (isset($methodTagsAndValues['param']) && isset($methodTagsAndValues['param'][$parameterPosition])) {
+                               $explodedParameters = explode(' ', $methodTagsAndValues['param'][$parameterPosition]);
+                               if (count($explodedParameters) >= 2) {
+                                       $parameterInformation['type'] = $explodedParameters[0];
+                               }
+                       }
+               }
+               if (isset($parameterInformation['type']) && $parameterInformation['type'][0] === '\\') {
+                       $parameterInformation['type'] = substr($parameterInformation['type'], 1);
+               }
+               return $parameterInformation;
+       }
+
+       /**
+        * Returns the Reflection of a method.
+        *
+        * @param string $className Name of the class containing the method
+        * @param string $methodName Name of the method to return the Reflection for
+        * @return \TYPO3\CMS\Extbase\Reflection\MethodReflection the method Reflection object
+        */
+       protected function getMethodReflection($className, $methodName) {
+               if (!isset($this->methodReflections[$className][$methodName])) {
+                       $this->methodReflections[$className][$methodName] = new \TYPO3\CMS\Extbase\Reflection\MethodReflection($className, $methodName);
+                       $this->dataCacheNeedsUpdate = TRUE;
+               }
+               return $this->methodReflections[$className][$methodName];
+       }
+
+       /**
+        * Tries to load the reflection data from this service's cache.
+        *
+        * @return void
+        */
+       protected function loadFromCache() {
+               $data = $this->dataCache->get($this->cacheIdentifier);
+               if ($data !== FALSE) {
+                       foreach ($data as $propertyName => $propertyValue) {
+                               $this->{$propertyName} = $propertyValue;
+                       }
+               }
+       }
+
+       /**
+        * Exports the internal reflection data into the ReflectionData cache.
+        *
+        * @throws Exception
+        * @return void
+        */
+       protected function saveToCache() {
+               if (!is_object($this->dataCache)) {
+                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
+               }
+               $data = array();
+               $propertyNames = array(
+                       'reflectedClassNames',
+                       'classPropertyNames',
+                       'classTagsValues',
+                       'methodTagsValues',
+                       'methodParameters',
+                       'propertyTagsValues',
+                       'taggedClasses',
+                       'classSchemata'
+               );
+               foreach ($propertyNames as $propertyName) {
+                       $data[$propertyName] = $this->{$propertyName};
+               }
+               $this->dataCache->set($this->cacheIdentifier, $data);
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Classes/Reflection/Service.php b/typo3/sysext/extbase/Classes/Reflection/Service.php
deleted file mode 100644 (file)
index cff5a55..0000000
+++ /dev/null
@@ -1,558 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Reflection;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * A backport of the FLOW3 reflection service for aquiring reflection based information.
- * Most of the code is based on the FLOW3 reflection service.
- *
- * @api
- */
-class Service implements \TYPO3\CMS\Core\SingletonInterface {
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-        */
-       protected $objectManager;
-
-       /**
-        * Whether this service has been initialized.
-        *
-        * @var boolean
-        */
-       protected $initialized = FALSE;
-
-       /**
-        * @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
-        */
-       protected $dataCache;
-
-       /**
-        * Whether class alterations should be detected on each initialization.
-        *
-        * @var boolean
-        */
-       protected $detectClassChanges = FALSE;
-
-       /**
-        * All available class names to consider. Class name = key, value is the
-        * UNIX timestamp the class was reflected.
-        *
-        * @var array
-        */
-       protected $reflectedClassNames = array();
-
-       /**
-        * Array of tags and the names of classes which are tagged with them.
-        *
-        * @var array
-        */
-       protected $taggedClasses = array();
-
-       /**
-        * Array of class names and their tags and values.
-        *
-        * @var array
-        */
-       protected $classTagsValues = array();
-
-       /**
-        * Array of class names, method names and their tags and values.
-        *
-        * @var array
-        */
-       protected $methodTagsValues = array();
-
-       /**
-        * Array of class names, method names, their parameters and additional
-        * information about the parameters.
-        *
-        * @var array
-        */
-       protected $methodParameters = array();
-
-       /**
-        * Array of class names and names of their properties.
-        *
-        * @var array
-        */
-       protected $classPropertyNames = array();
-
-       /**
-        * Array of class names, property names and their tags and values.
-        *
-        * @var array
-        */
-       protected $propertyTagsValues = array();
-
-       /**
-        * List of tags which are ignored while reflecting class and method annotations.
-        *
-        * @var array
-        */
-       protected $ignoredTags = array('package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const');
-
-       /**
-        * Indicates whether the Reflection cache needs to be updated.
-        *
-        * This flag needs to be set as soon as new Reflection information was
-        * created.
-        *
-        * @see reflectClass()
-        * @see getMethodReflection()
-        * @var boolean
-        */
-       protected $dataCacheNeedsUpdate = FALSE;
-
-       /**
-        * Local cache for Class schemata
-        *
-        * @var array
-        */
-       protected $classSchemata = array();
-
-       /**
-        * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
-        */
-       protected $configurationManager;
-
-       /**
-        * @var string
-        */
-       protected $cacheIdentifier;
-
-       /**
-        * @var array
-        */
-       protected $methodReflections;
-
-       /**
-        * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
-        * @return void
-        */
-       public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager) {
-               $this->objectManager = $objectManager;
-       }
-
-       /**
-        * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
-        * @return void
-        */
-       public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager) {
-               $this->configurationManager = $configurationManager;
-       }
-
-       /**
-        * Sets the data cache.
-        *
-        * The cache must be set before initializing the Reflection Service.
-        *
-        * @param \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache Cache for the Reflection service
-        * @return void
-        */
-       public function setDataCache(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache) {
-               $this->dataCache = $dataCache;
-       }
-
-       /**
-        * Initializes this service
-        *
-        * @throws Exception
-        * @return void
-        */
-       public function initialize() {
-               if ($this->initialized) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('The Reflection Service can only be initialized once.', 1232044696);
-               }
-               $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
-               $this->cacheIdentifier = 'ReflectionData_' . $frameworkConfiguration['extensionName'];
-               $this->loadFromCache();
-               $this->initialized = TRUE;
-       }
-
-       /**
-        * Returns whether the Reflection Service is initialized.
-        *
-        * @return boolean true if the Reflection Service is initialized, otherwise false
-        */
-       public function isInitialized() {
-               return $this->initialized;
-       }
-
-       /**
-        * Shuts the Reflection Service down.
-        *
-        * @return void
-        */
-       public function shutdown() {
-               if ($this->dataCacheNeedsUpdate) {
-                       $this->saveToCache();
-               }
-               $this->initialized = FALSE;
-       }
-
-       /**
-        * Returns the names of all properties of the specified class
-        *
-        * @param string $className Name of the class to return the property names of
-        * @return array An array of property names or an empty array if none exist
-        */
-       public function getClassPropertyNames($className) {
-               if (!isset($this->reflectedClassNames[$className])) {
-                       $this->reflectClass($className);
-               }
-               return isset($this->classPropertyNames[$className]) ? $this->classPropertyNames[$className] : array();
-       }
-
-       /**
-        * Returns the class schema for the given class
-        *
-        * @param mixed $classNameOrObject The class name or an object
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassSchema
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        */
-       public function getClassSchema($classNameOrObject) {
-               $className = is_object($classNameOrObject) ? get_class($classNameOrObject) : $classNameOrObject;
-               if (isset($this->classSchemata[$className])) {
-                       return $this->classSchemata[$className];
-               } else {
-                       return $this->buildClassSchema($className);
-               }
-       }
-
-       /**
-        * Returns all tags and their values the specified method is tagged with
-        *
-        * @param string $className Name of the class containing the method
-        * @param string $methodName Name of the method to return the tags and values of
-        * @return array An array of tags and their values or an empty array of no tags were found
-        */
-       public function getMethodTagsValues($className, $methodName) {
-               if (!isset($this->methodTagsValues[$className][$methodName])) {
-                       $this->methodTagsValues[$className][$methodName] = array();
-                       $method = $this->getMethodReflection($className, $methodName);
-                       foreach ($method->getTagsValues() as $tag => $values) {
-                               if (array_search($tag, $this->ignoredTags) === FALSE) {
-                                       $this->methodTagsValues[$className][$methodName][$tag] = $values;
-                               }
-                       }
-               }
-               return $this->methodTagsValues[$className][$methodName];
-       }
-
-       /**
-        * Returns an array of parameters of the given method. Each entry contains
-        * additional information about the parameter position, type hint etc.
-        *
-        * @param string $className Name of the class containing the method
-        * @param string $methodName Name of the method to return parameter information of
-        * @return array An array of parameter names and additional information or an empty array of no parameters were found
-        */
-       public function getMethodParameters($className, $methodName) {
-               if (!isset($this->methodParameters[$className][$methodName])) {
-                       $method = $this->getMethodReflection($className, $methodName);
-                       $this->methodParameters[$className][$methodName] = array();
-                       foreach ($method->getParameters() as $parameterPosition => $parameter) {
-                               $this->methodParameters[$className][$methodName][$parameter->getName()] = $this->convertParameterReflectionToArray($parameter, $parameterPosition, $method);
-                       }
-               }
-               return $this->methodParameters[$className][$methodName];
-       }
-
-       /**
-        * Returns all tags and their values the specified class property is tagged with
-        *
-        * @param string $className Name of the class containing the property
-        * @param string $propertyName Name of the property to return the tags and values of
-        * @return array An array of tags and their values or an empty array of no tags were found
-        */
-       public function getPropertyTagsValues($className, $propertyName) {
-               if (!isset($this->reflectedClassNames[$className])) {
-                       $this->reflectClass($className);
-               }
-               if (!isset($this->propertyTagsValues[$className])) {
-                       return array();
-               }
-               return isset($this->propertyTagsValues[$className][$propertyName]) ? $this->propertyTagsValues[$className][$propertyName] : array();
-       }
-
-       /**
-        * Returns the values of the specified class property tag
-        *
-        * @param string $className Name of the class containing the property
-        * @param string $propertyName Name of the tagged property
-        * @param string $tag Tag to return the values of
-        * @return array An array of values or an empty array if the tag was not found
-        * @author Robert Lemke <robert@typo3.org>
-        * @api
-        */
-       public function getPropertyTagValues($className, $propertyName, $tag) {
-               if (!isset($this->reflectedClassNames[$className])) {
-                       $this->reflectClass($className);
-               }
-               if (!isset($this->propertyTagsValues[$className][$propertyName])) {
-                       return array();
-               }
-               return isset($this->propertyTagsValues[$className][$propertyName][$tag]) ? $this->propertyTagsValues[$className][$propertyName][$tag] : array();
-       }
-
-       /**
-        * Tells if the specified class is known to this reflection service and
-        * reflection information is available.
-        *
-        * @param string $className Name of the class
-        * @return boolean If the class is reflected by this service
-        * @author Robert Lemke <robert@typo3.org>
-        * @api
-        */
-       public function isClassReflected($className) {
-               return isset($this->reflectedClassNames[$className]);
-       }
-
-       /**
-        * Tells if the specified class is tagged with the given tag
-        *
-        * @param string $className Name of the class
-        * @param string $tag Tag to check for
-        * @return boolean TRUE if the class is tagged with $tag, otherwise FALSE
-        * @author Robert Lemke <robert@typo3.org>
-        * @api
-        */
-       public function isClassTaggedWith($className, $tag) {
-               if ($this->initialized === FALSE) {
-                       return FALSE;
-               }
-               if (!isset($this->reflectedClassNames[$className])) {
-                       $this->reflectClass($className);
-               }
-               if (!isset($this->classTagsValues[$className])) {
-                       return FALSE;
-               }
-               return isset($this->classTagsValues[$className][$tag]);
-       }
-
-       /**
-        * Tells if the specified class property is tagged with the given tag
-        *
-        * @param string $className Name of the class
-        * @param string $propertyName Name of the property
-        * @param string $tag Tag to check for
-        * @return boolean TRUE if the class property is tagged with $tag, otherwise FALSE
-        * @author Robert Lemke <robert@typo3.org>
-        * @api
-        */
-       public function isPropertyTaggedWith($className, $propertyName, $tag) {
-               if (!isset($this->reflectedClassNames[$className])) {
-                       $this->reflectClass($className);
-               }
-               if (!isset($this->propertyTagsValues[$className])) {
-                       return FALSE;
-               }
-               if (!isset($this->propertyTagsValues[$className][$propertyName])) {
-                       return FALSE;
-               }
-               return isset($this->propertyTagsValues[$className][$propertyName][$tag]);
-       }
-
-       /**
-        * Reflects the given class and stores the results in this service's properties.
-        *
-        * @param string $className Full qualified name of the class to reflect
-        * @return void
-        */
-       protected function reflectClass($className) {
-               $class = new \TYPO3\CMS\Extbase\Reflection\ClassReflection($className);
-               $this->reflectedClassNames[$className] = time();
-               foreach ($class->getTagsValues() as $tag => $values) {
-                       if (array_search($tag, $this->ignoredTags) === FALSE) {
-                               $this->taggedClasses[$tag][] = $className;
-                               $this->classTagsValues[$className][$tag] = $values;
-                       }
-               }
-               foreach ($class->getProperties() as $property) {
-                       $propertyName = $property->getName();
-                       $this->classPropertyNames[$className][] = $propertyName;
-                       foreach ($property->getTagsValues() as $tag => $values) {
-                               if (array_search($tag, $this->ignoredTags) === FALSE) {
-                                       $this->propertyTagsValues[$className][$propertyName][$tag] = $values;
-                               }
-                       }
-               }
-               foreach ($class->getMethods() as $method) {
-                       $methodName = $method->getName();
-                       foreach ($method->getTagsValues() as $tag => $values) {
-                               if (array_search($tag, $this->ignoredTags) === FALSE) {
-                                       $this->methodTagsValues[$className][$methodName][$tag] = $values;
-                               }
-                       }
-                       foreach ($method->getParameters() as $parameterPosition => $parameter) {
-                               $this->methodParameters[$className][$methodName][$parameter->getName()] = $this->convertParameterReflectionToArray($parameter, $parameterPosition, $method);
-                       }
-               }
-               ksort($this->reflectedClassNames);
-               $this->dataCacheNeedsUpdate = TRUE;
-       }
-
-       /**
-        * Builds class schemata from classes annotated as entities or value objects
-        *
-        * @param string $className
-        * @throws Exception\UnknownClassException
-        * @return \TYPO3\CMS\Extbase\Reflection\ClassSchema The class schema
-        */
-       protected function buildClassSchema($className) {
-               if (!class_exists($className)) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception\UnknownClassException('The classname "' . $className . '" was not found and thus can not be reflected.', 1278450972);
-               }
-               $classSchema = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Reflection\\ClassSchema', $className);
-               if (is_subclass_of($className, 'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity')) {
-                       $classSchema->setModelType(\TYPO3\CMS\Extbase\Reflection\ClassSchema::MODELTYPE_ENTITY);
-                       if (strpos($className, '\\') !== FALSE) {
-                               $possibleRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', $className) . 'Repository';
-                       } else {
-                               $possibleRepositoryClassName = str_replace('_Model_', '_Repository_', $className) . 'Repository';
-                       }
-                       if (class_exists($possibleRepositoryClassName)) {
-                               $classSchema->setAggregateRoot(TRUE);
-                       }
-               } elseif (is_subclass_of($className, 'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractValueObject')) {
-                       $classSchema->setModelType(\TYPO3\CMS\Extbase\Reflection\ClassSchema::MODELTYPE_VALUEOBJECT);
-               } else {
-                       return NULL;
-               }
-               foreach ($this->getClassPropertyNames($className) as $propertyName) {
-                       if (!$this->isPropertyTaggedWith($className, $propertyName, 'transient') && $this->isPropertyTaggedWith($className, $propertyName, 'var')) {
-                               $cascadeTagValues = $this->getPropertyTagValues($className, $propertyName, 'cascade');
-                               $classSchema->addProperty($propertyName, implode(' ', $this->getPropertyTagValues($className, $propertyName, 'var')), $this->isPropertyTaggedWith($className, $propertyName, 'lazy'), $cascadeTagValues[0]);
-                       }
-                       if ($this->isPropertyTaggedWith($className, $propertyName, 'uuid')) {
-                               $classSchema->setUuidPropertyName($propertyName);
-                       }
-                       if ($this->isPropertyTaggedWith($className, $propertyName, 'identity')) {
-                               $classSchema->markAsIdentityProperty($propertyName);
-                       }
-               }
-               $this->classSchemata[$className] = $classSchema;
-               $this->dataCacheNeedsUpdate = TRUE;
-               return $classSchema;
-       }
-
-       /**
-        * Converts the given parameter reflection into an information array
-        *
-        * @param \ReflectionParameter $parameter The parameter to reflect
-        * @param integer $parameterPosition
-        * @param \ReflectionMethod|NULL $method
-        * @return array Parameter information array
-        */
-       protected function convertParameterReflectionToArray(\ReflectionParameter $parameter, $parameterPosition, \ReflectionMethod $method = NULL) {
-               $parameterInformation = array(
-                       'position' => $parameterPosition,
-                       'byReference' => $parameter->isPassedByReference() ? TRUE : FALSE,
-                       'array' => $parameter->isArray() ? TRUE : FALSE,
-                       'optional' => $parameter->isOptional() ? TRUE : FALSE,
-                       'allowsNull' => $parameter->allowsNull() ? TRUE : FALSE
-               );
-               $parameterClass = $parameter->getClass();
-               $parameterInformation['class'] = $parameterClass !== NULL ? $parameterClass->getName() : NULL;
-               if ($parameter->isDefaultValueAvailable()) {
-                       $parameterInformation['defaultValue'] = $parameter->getDefaultValue();
-               }
-               if ($parameterClass !== NULL) {
-                       $parameterInformation['type'] = $parameterClass->getName();
-               } elseif ($method !== NULL) {
-                       $methodTagsAndValues = $this->getMethodTagsValues($method->getDeclaringClass()->getName(), $method->getName());
-                       if (isset($methodTagsAndValues['param']) && isset($methodTagsAndValues['param'][$parameterPosition])) {
-                               $explodedParameters = explode(' ', $methodTagsAndValues['param'][$parameterPosition]);
-                               if (count($explodedParameters) >= 2) {
-                                       $parameterInformation['type'] = $explodedParameters[0];
-                               }
-                       }
-               }
-               if (isset($parameterInformation['type']) && $parameterInformation['type'][0] === '\\') {
-                       $parameterInformation['type'] = substr($parameterInformation['type'], 1);
-               }
-               return $parameterInformation;
-       }
-
-       /**
-        * Returns the Reflection of a method.
-        *
-        * @param string $className Name of the class containing the method
-        * @param string $methodName Name of the method to return the Reflection for
-        * @return \TYPO3\CMS\Extbase\Reflection\MethodReflection the method Reflection object
-        */
-       protected function getMethodReflection($className, $methodName) {
-               if (!isset($this->methodReflections[$className][$methodName])) {
-                       $this->methodReflections[$className][$methodName] = new \TYPO3\CMS\Extbase\Reflection\MethodReflection($className, $methodName);
-                       $this->dataCacheNeedsUpdate = TRUE;
-               }
-               return $this->methodReflections[$className][$methodName];
-       }
-
-       /**
-        * Tries to load the reflection data from this service's cache.
-        *
-        * @return void
-        */
-       protected function loadFromCache() {
-               $data = $this->dataCache->get($this->cacheIdentifier);
-               if ($data !== FALSE) {
-                       foreach ($data as $propertyName => $propertyValue) {
-                               $this->{$propertyName} = $propertyValue;
-                       }
-               }
-       }
-
-       /**
-        * Exports the internal reflection data into the ReflectionData cache.
-        *
-        * @throws Exception
-        * @return void
-        */
-       protected function saveToCache() {
-               if (!is_object($this->dataCache)) {
-                       throw new \TYPO3\CMS\Extbase\Reflection\Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
-               }
-               $data = array();
-               $propertyNames = array(
-                       'reflectedClassNames',
-                       'classPropertyNames',
-                       'classTagsValues',
-                       'methodTagsValues',
-                       'methodParameters',
-                       'propertyTagsValues',
-                       'taggedClasses',
-                       'classSchemata'
-               );
-               foreach ($propertyNames as $propertyName) {
-                       $data[$propertyName] = $this->{$propertyName};
-               }
-               $this->dataCache->set($this->cacheIdentifier, $data);
-       }
-
-}
-
-
-?>
\ No newline at end of file
index e05029a..899a95d 100644 (file)
@@ -39,7 +39,7 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
        protected $objectManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -53,12 +53,12 @@ class FieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInter
         *
         * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
         * @param \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         */
-       public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = NULL, \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager = NULL, \TYPO3\CMS\Extbase\Reflection\Service $reflectionService = NULL) {
+       public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = NULL, \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager = NULL, \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService = NULL) {
                $this->objectManager = $objectManager !== NULL ? $objectManager : \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $this->commandManager = $commandManager !== NULL ? $commandManager : $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager');
-               $this->reflectionService = $reflectionService !== NULL ? $reflectionService : $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $this->reflectionService = $reflectionService !== NULL ? $reflectionService : $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
        }
 
        /**
index 64a419c..98d0b3d 100644 (file)
@@ -89,7 +89,7 @@ class TaskExecutor implements \TYPO3\CMS\Core\SingletonInterface {
                        }
                }
                // initialize reflection
-               $reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $reflectionService->setDataCache($GLOBALS['typo3CacheManager']->getCache('extbase_reflection'));
                if (!$reflectionService->isInitialized()) {
                        $reflectionService->initialize();
@@ -131,7 +131,7 @@ class TaskExecutor implements \TYPO3\CMS\Core\SingletonInterface {
                // shutdown
                $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
                $persistenceManager->persistAll();
-               $reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $reflectionService->shutdown();
        }
 
index 7a786f9..499f1a3 100644 (file)
@@ -47,7 +47,7 @@ class DebuggerUtility {
        static protected $blacklistedClassNames = array(
                'PHPUnit_Framework_MockObject_InvocationMocker',
                'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\IdentityMap',
-               'TYPO3\\CMS\\Extbase\\Reflection\\Service',
+               'TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService',
                'TYPO3\\CMS\\Extbase\\Object\\ObjectManager',
                'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper',
                'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager',
index c31e934..58f9c1b 100644 (file)
@@ -70,7 +70,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
        protected $objectManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $reflectionService;
 
@@ -92,10 +92,10 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Injects the reflection service
         *
-        * @param \TYPO3\CMS\Extbase\Reflection\Service $reflectionService
+        * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
         * @return void
         */
-       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\Service $reflectionService) {
+       public function injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService) {
                $this->reflectionService = $reflectionService;
        }
 
index 719601a..ee2fdea 100644 (file)
@@ -260,7 +260,7 @@ return array(
        'Tx_Extbase_Reflection_ObjectAccess' => 'TYPO3\\CMS\\Extbase\\Reflection\\ObjectAccess',
        'Tx_Extbase_Reflection_ParameterReflection' => 'TYPO3\\CMS\\Extbase\\Reflection\\ParameterReflection',
        'Tx_Extbase_Reflection_PropertyReflection' => 'TYPO3\\CMS\\Extbase\\Reflection\\PropertyReflection',
-       'Tx_Extbase_Reflection_Service' => 'TYPO3\\CMS\\Extbase\\Reflection\\Service',
+       'Tx_Extbase_Reflection_Service' => 'TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService',
        'Tx_Extbase_Scheduler_FieldProvider' => 'TYPO3\\CMS\\Extbase\\Scheduler\\FieldProvider',
        'Tx_Extbase_Scheduler_Task' => 'TYPO3\\CMS\\Extbase\\Scheduler\\Task',
        'Tx_Extbase_Scheduler_TaskExecutor' => 'TYPO3\\CMS\\Extbase\\Scheduler\\TaskExecutor',
index 20c32c1..dae9bef 100644 (file)
@@ -132,7 +132,7 @@ class CommandTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
         */
        public function getArgumentDefinitionsReturnsArrayOfArgumentDefinitionIfCommandExpectsArguments() {
                $mockParameterReflection = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ParameterReflection', array(), array(), '', FALSE);
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $mockMethodParameters = array('argument1' => array('optional' => FALSE), 'argument2' => array('optional' => TRUE));
                $mockReflectionService->expects($this->atLeastOnce())->method('getMethodParameters')->will($this->returnValue($mockMethodParameters));
                $this->command->injectReflectionService($mockReflectionService);
index ddbc3a6..9dfadcc 100644 (file)
@@ -51,7 +51,7 @@ class RequestBuilderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        protected $mockCommandManager;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Reflection\Service
+        * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
         */
        protected $mockReflectionService;
 
@@ -69,7 +69,7 @@ class RequestBuilderTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
                $this->mockCommandManager = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager');
                $this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('some_extension_name:default:list')->will($this->returnValue($this->mockCommand));
-               $this->mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $this->mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $this->requestBuilder = new \TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder();
                $this->requestBuilder->injectObjectManager($this->mockObjectManager);
                $this->requestBuilder->injectReflectionService($this->mockReflectionService);
index 5ab26cf..d66ca74 100644 (file)
@@ -284,7 +284,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                                'type' => 'F3_Foo_Bar'
                        )
                );
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
                $mockController->injectReflectionService($mockReflectionService);
                $mockController->_set('request', $mockRequest);
@@ -331,7 +331,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                                'type' => 'string'
                        )
                );
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
                $mockController->injectReflectionService($mockReflectionService);
                $mockController->_set('request', $mockRequest);
@@ -358,7 +358,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                                'allowsNull' => FALSE
                        )
                );
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
                $mockController->injectReflectionService($mockReflectionService);
                $mockController->_set('request', $mockRequest);
@@ -381,7 +381,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $methodTagsValues = array();
                $methodArgumentsValidatorConjunctions = array();
                $methodArgumentsValidatorConjunctions['arg1'] = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\ConjunctionValidator', array(), array(), '', FALSE);
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockValidatorResolver = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver', array(), array(), '', FALSE);
                $mockValidatorResolver->expects($this->once())->method('buildMethodArgumentsValidatorConjunctions')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodArgumentsValidatorConjunctions));
@@ -410,7 +410,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $methodArgumentsValidatorConjunctions = array();
                $methodArgumentsValidatorConjunctions['arg1'] = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\ConjunctionValidator', array(), array(), '', FALSE);
                $methodArgumentsValidatorConjunctions['arg1']->expects($this->once())->method('addValidator')->with($quuxBaseValidatorConjunction);
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockValidatorResolver = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver', array(), array(), '', FALSE);
                $mockValidatorResolver->expects($this->once())->method('buildMethodArgumentsValidatorConjunctions')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodArgumentsValidatorConjunctions));
@@ -442,7 +442,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                );
                $methodArgumentsValidatorConjunctions = array();
                $methodArgumentsValidatorConjunctions['arg1'] = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\ConjunctionValidator', array(), array(), '', FALSE);
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockValidatorResolver = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver', array(), array(), '', FALSE);
                $mockValidatorResolver->expects($this->once())->method('buildMethodArgumentsValidatorConjunctions')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodArgumentsValidatorConjunctions));
@@ -518,7 +518,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $argument2->expects($this->any())->method('getOrigin')->will($this->returnValue($argument2Origin));
                $mockController = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ActionController', array('dummy'), array(), '', FALSE);
                $this->enableDeprecatedPropertyMapperInController($mockController);
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array('getMethodTagsValues'), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array('getMethodTagsValues'), array(), '', FALSE);
                if ($reflectionServiceNeedsInitialization) {
                        // Somehow this is needed, else I get "Mocked method does not exist."
                        $mockReflectionService->expects($this->any())->method('getMethodTagsValues')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodTagsValues));
@@ -548,7 +548,7 @@ class ActionControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $argument2->expects($this->any())->method('getOrigin')->will($this->returnValue($argument2Origin));
                $mockController = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ActionController', array('dummy'), array(), '', FALSE);
                $this->enableDeprecatedPropertyMapperInController($mockController);
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array('getMethodTagsValues'), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array('getMethodTagsValues'), array(), '', FALSE);
                $mockReflectionService->expects($this->any())->method('getMethodTagsValues')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockController->_set('arguments', array($argument1, $argument2));
                $mockController->_set('request', $mockRequest);
index c84a774..484ca78 100644 (file)
@@ -199,7 +199,7 @@ class ArgumentTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                /** @var $argument \TYPO3\CMS\Extbase\Mvc\Controller\Argument|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $argument = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\Argument', array('dummy'), array(), '', FALSE);
                $argument->_set('dataType', $dataType);
-               $reflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $reflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $reflectionService->expects($this->once())->method('getClassSchema')->with($dataType);
                $argument->injectReflectionService($reflectionService);
        }
@@ -223,7 +223,7 @@ class ArgumentTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                /** @var $argument \TYPO3\CMS\Extbase\Mvc\Controller\Argument|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
                $argument = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\Argument', array('dummy'), array(), '', FALSE);
                $argument->_set('dataType', $dataType);
-               $reflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $reflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $reflectionService->expects($this->never())->method('getClassSchema');
                $argument->injectReflectionService($reflectionService);
        }
index fbf46b2..3dac539 100644 (file)
@@ -421,7 +421,7 @@ class DataMapFactoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
                $configurationManager->expects($this->once())->method('getConfiguration')->with('Framework')->will($this->returnValue($configuration));
                $dataMapFactory = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapFactory', array('test'));
-               $dataMapFactory->injectReflectionService(new \TYPO3\CMS\Extbase\Reflection\Service());
+               $dataMapFactory->injectReflectionService(new \TYPO3\CMS\Extbase\Reflection\ReflectionService());
                $dataMapFactory->injectObjectManager(new \TYPO3\CMS\Extbase\Object\ObjectManager());
                $dataMapFactory->injectConfigurationManager($configurationManager);
                $cacheMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', array(), array(), '', false);
index be55832..121018c 100644 (file)
@@ -93,7 +93,7 @@ class DataMapperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $classSchema->addProperty('secondProperty', 'integer');
                $classSchema->addProperty('thirdProperty', 'float');
                $classSchema->addProperty('fourthProperty', 'boolean');
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array('getClassSchema'));
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array('getClassSchema'));
                $mockReflectionService->expects($this->any())->method('getClassSchema')->will($this->returnValue($classSchema));
                $dataMapper = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('dummy'));
                $dataMapper->_set('dataMaps', $dataMaps);
index 548356e..9fc7509 100644 (file)
@@ -52,8 +52,8 @@ class MapperTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                /** @var \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory $queryFactory */
                $queryFactory = new \TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory();
 
-               /** @var \TYPO3\CMS\Extbase\Reflection\Service $reflectionService */
-               $reflectionService = new \TYPO3\CMS\Extbase\Reflection\Service();
+               /** @var \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService */
+               $reflectionService = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
                $reflectionService->injectObjectManager($objectManager);
 
                /** @var \TYPO3\CMS\Extbase\Validation\ValidatorResolver $validatorResolver */
index 1bf7d44..9df85e4 100644 (file)
@@ -42,7 +42,7 @@ class PersistentObjectConverterTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTe
 
        public function setUp() {
                $this->converter = new \TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter();
-               $this->mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service');
+               $this->mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
                $this->converter->injectReflectionService($this->mockReflectionService);
                $this->mockPersistenceManager = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface');
                $this->converter->injectPersistenceManager($this->mockPersistenceManager);
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php
new file mode 100644 (file)
index 0000000..d9eba4c
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Some functional tests for the backport of the reflection service
+ */
+class ReflectionServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
+
+       /**
+        * @param array $foo The foo parameter
+        * @return void
+        */
+       public function fixtureMethodForMethodTagsValues(array $foo) {
+
+       }
+
+       /**
+        * @test
+        */
+       public function getMethodTagsValues() {
+               $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
+               $tagsValues = $service->getMethodTagsValues('TYPO3\\CMS\\Extbase\\Tests\\Unit\\Reflection\\ReflectionServiceTest', 'fixtureMethodForMethodTagsValues');
+               $this->assertEquals(array(
+                       'param' => array('array $foo The foo parameter'),
+                       'return' => array('void')
+               ), $tagsValues);
+       }
+
+       /**
+        * @test
+        */
+       public function getMethodParameters() {
+               $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
+               $parameters = $service->getMethodParameters('TYPO3\\CMS\\Extbase\\Tests\\Unit\\Reflection\\ReflectionServiceTest', 'fixtureMethodForMethodTagsValues');
+               $this->assertEquals(array(
+                       'foo' => array(
+                               'position' => 0,
+                               'byReference' => FALSE,
+                               'array' => TRUE,
+                               'optional' => FALSE,
+                               'allowsNull' => FALSE,
+                               'class' => NULL,
+                               'type' => 'array'
+                       )
+               ), $parameters);
+       }
+
+       /**
+        * @test
+        */
+       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNamespacedClasses() {
+               $className = uniqid('BazFixture');
+               eval ('
+                       namespace Foo\\Bar\\Domain\\Model;
+                       class ' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
+               ');
+               eval ('
+                       namespace Foo\\Bar\\Domain\\Repository;
+                       class ' . $className . 'Repository {}
+               ');
+
+               $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
+               $service->injectObjectManager($this->objectManager);
+               $classSchema = $service->getClassSchema('Foo\\Bar\\Domain\\Model\\' . $className);
+               $this->assertTrue($classSchema->isAggregateRoot());
+       }
+
+       /**
+        * @test
+        */
+       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNotNamespacedClasses() {
+               $className = uniqid('BazFixture');
+               eval ('
+                       class Foo_Bar_Domain_Model_' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
+               ');
+               eval ('
+                       class Foo_Bar_Domain_Repository_' . $className . 'Repository {}
+               ');
+
+               $service = new \TYPO3\CMS\Extbase\Reflection\ReflectionService();
+               $service->injectObjectManager($this->objectManager);
+               $classSchema = $service->getClassSchema('Foo_Bar_Domain_Model_' . $className);
+               $this->assertTrue($classSchema->isAggregateRoot());
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/ServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Reflection/ServiceTest.php
deleted file mode 100644 (file)
index 151db1e..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Some functional tests for the backport of the reflection service
- */
-class ServiceTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
-
-       /**
-        * @param array $foo The foo parameter
-        * @return void
-        */
-       public function fixtureMethodForMethodTagsValues(array $foo) {
-
-       }
-
-       /**
-        * @test
-        */
-       public function getMethodTagsValues() {
-               $service = new \TYPO3\CMS\Extbase\Reflection\Service();
-               $tagsValues = $service->getMethodTagsValues('TYPO3\\CMS\\Extbase\\Tests\\Unit\\Reflection\\ServiceTest', 'fixtureMethodForMethodTagsValues');
-               $this->assertEquals(array(
-                       'param' => array('array $foo The foo parameter'),
-                       'return' => array('void')
-               ), $tagsValues);
-       }
-
-       /**
-        * @test
-        */
-       public function getMethodParameters() {
-               $service = new \TYPO3\CMS\Extbase\Reflection\Service();
-               $parameters = $service->getMethodParameters('TYPO3\\CMS\\Extbase\\Tests\\Unit\\Reflection\\ServiceTest', 'fixtureMethodForMethodTagsValues');
-               $this->assertEquals(array(
-                       'foo' => array(
-                               'position' => 0,
-                               'byReference' => FALSE,
-                               'array' => TRUE,
-                               'optional' => FALSE,
-                               'allowsNull' => FALSE,
-                               'class' => NULL,
-                               'type' => 'array'
-                       )
-               ), $parameters);
-       }
-
-       /**
-        * @test
-        */
-       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNamespacedClasses() {
-               $className = uniqid('BazFixture');
-               eval ('
-                       namespace Foo\\Bar\\Domain\\Model;
-                       class ' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
-               ');
-               eval ('
-                       namespace Foo\\Bar\\Domain\\Repository;
-                       class ' . $className . 'Repository {}
-               ');
-
-               $service = new \TYPO3\CMS\Extbase\Reflection\Service();
-               $service->injectObjectManager($this->objectManager);
-               $classSchema = $service->getClassSchema('Foo\\Bar\\Domain\\Model\\' . $className);
-               $this->assertTrue($classSchema->isAggregateRoot());
-       }
-
-       /**
-        * @test
-        */
-       public function classSchemaForModelIsSetAggregateRootIfRepositoryClassIsFoundForNotNamespacedClasses() {
-               $className = uniqid('BazFixture');
-               eval ('
-                       class Foo_Bar_Domain_Model_' . $className . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {}
-               ');
-               eval ('
-                       class Foo_Bar_Domain_Repository_' . $className . 'Repository {}
-               ');
-
-               $service = new \TYPO3\CMS\Extbase\Reflection\Service();
-               $service->injectObjectManager($this->objectManager);
-               $classSchema = $service->getClassSchema('Foo_Bar_Domain_Model_' . $className);
-               $this->assertTrue($classSchema->isAggregateRoot());
-       }
-
-}
-
-
-?>
\ No newline at end of file
index 6c1ee3f..14e143e 100644 (file)
@@ -156,7 +156,7 @@ class ValidatorResolverTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $mockController = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ActionController', array('fooAction'), array(), '', FALSE);
                $methodTagsValues = array();
                $methodParameters = array();
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockController), 'fooAction')->will($this->returnValue($methodParameters));
                $validatorResolver = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver', array('createValidator'));
@@ -190,7 +190,7 @@ class ValidatorResolverTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                                '$arg2 F3_TestPackage_Quux'
                        )
                );
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodParameters));
                $mockStringValidator = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface', array(), array(), '', FALSE);
@@ -242,7 +242,7 @@ class ValidatorResolverTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                                '$arg2 F3_TestPackage_Quux'
                        )
                );
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodTagsValues));
                $mockReflectionService->expects($this->once())->method('getMethodParameters')->with(get_class($mockObject), 'fooAction')->will($this->returnValue($methodParameters));
                $mockStringValidator = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface', array(), array(), '', FALSE);
@@ -280,7 +280,7 @@ class ValidatorResolverTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                                )
                        )
                );
-               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\Service', array(), array(), '', FALSE);
+               $mockReflectionService = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService', array(), array(), '', FALSE);
                $mockReflectionService->expects($this->at(0))->method('getClassPropertyNames')->with($className)->will($this->returnValue(array('foo', 'bar')));
                $mockReflectionService->expects($this->at(1))->method('getPropertyTagsValues')->with($className, 'foo')->will($this->returnValue($propertyTagsValues['foo']));
                $mockReflectionService->expects($this->at(2))->method('getPropertyTagsValues')->with($className, 'bar')->will($this->returnValue($propertyTagsValues['bar']));