1616use Cundd \Rest \Exception \InvalidConfigurationException ;
1717use Cundd \Rest \Handler \HandlerInterface ;
1818use Cundd \Rest \Http \RestRequestInterface ;
19- use TYPO3 \CMS \Extbase \Object \ObjectManager as BaseObjectManager ;
20- use TYPO3 \CMS \Extbase \Object \ObjectManagerInterface as TYPO3ObjectManagerInterface ;
19+ use Psr \Container \ContainerInterface ;
20+ use TYPO3 \CMS \Core \Utility \GeneralUtility ;
21+ use TYPO3 \CMS \Extbase \Object \ObjectManager as TYPO3ObjectManager ;
2122
2223/**
2324 * Specialized Object Manager
2425 *
25- * @method mixed get($class)
2626 * @method bool isRegistered($class)
2727 */
28- class ObjectManager extends BaseObjectManager implements TYPO3ObjectManagerInterface, ObjectManagerInterface, SingletonInterface
28+ class ObjectManager implements ObjectManagerInterface, SingletonInterface
2929{
3030 /**
3131 * @var DataProviderInterface
@@ -49,6 +49,26 @@ class ObjectManager extends BaseObjectManager implements TYPO3ObjectManagerInter
4949 */
5050 protected $ accessController ;
5151
52+ /**
53+ * @var ContainerInterface|\TYPO3\CMS\Extbase\Object\ObjectManagerInterface
54+ */
55+ protected $ container ;
56+
57+ /**
58+ * Object Manager constructor
59+ *
60+ * @param ContainerInterface|\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $container
61+ */
62+ public function __construct ($ container = null )
63+ {
64+ $ this ->container = $ container ?: GeneralUtility::makeInstance (TYPO3ObjectManager::class);
65+ }
66+
67+ public function get ($ class , ...$ arguments )
68+ {
69+ return $ this ->container ->get ($ class , ...$ arguments );
70+ }
71+
5272 /**
5373 * Returns the Response Factory
5474 *
@@ -302,4 +322,9 @@ private function getHandlerFromResourceConfiguration(ResourceType $resourceType)
302322
303323 return $ this ->get ($ handlerClass );
304324 }
325+
326+ public function __call ($ name , $ arguments )
327+ {
328+ return call_user_func_array ([$ this ->container , $ name ], $ arguments );
329+ }
305330}
0 commit comments