当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectManager::create方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Extbase\Object\ObjectManager::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManager::create方法的具体用法?PHP ObjectManager::create怎么用?PHP ObjectManager::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Extbase\Object\ObjectManager的用法示例。


在下文中一共展示了ObjectManager::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeBehaviors

 /**
  * @param array $behaviors
  * @param $object
  * @param $controllerContext
  * @param $default
  * @param array $extraConf
  * @return bool|object
  */
 public function executeBehaviors(array $behaviors, $object, $controllerContext, $default, $extraConf = array())
 {
     $behaviorResponse = false;
     foreach ($behaviors as $behaviorClassName => $enabled) {
         if (is_array($enabled) && $enabled['_typoScriptNodeValue'] == true || !is_array($enabled) && $enabled == true) {
             if (is_array($enabled)) {
                 $conf = $enabled;
             } else {
                 $conf = array();
             }
             $conf = array_merge_recursive($conf, $extraConf);
             $behavior = $this->objectManager->create($behaviorClassName);
             $behavior->setControllerContext($controllerContext);
             $result = $behavior->execute($object, $conf);
             if ($result) {
                 $behaviorResponse = $result;
             }
         }
     }
     if ($behaviorResponse == false) {
         $behaviorResponse = $this->objectManager->create('CIC\\Cicregister\\Behaviors\\Response\\RenderAction');
         $behaviorResponse->setValue($default);
     }
     return $behaviorResponse;
 }
开发者ID:busynoggin,项目名称:cicregister,代码行数:33,代码来源:Behavior.php

示例2: execute

 /**
  * @param \CIC\Cicregister\Domain\Model\FrontendUser $frontendUser
  * @param array $conf
  * @return string
  */
 public function execute(\CIC\Cicregister\Domain\Model\FrontendUser $frontendUser, array $conf)
 {
     // This method generates a login hash, which gets validated in the authentication service.
     // The login hash is part of a query string that the user is redirected to.
     $hashValidator = $this->objectManager->get('CIC\\Cicregister\\Service\\HashValidator');
     $loginHash = $hashValidator->generateShortLivedKey($frontendUser->getUid());
     $uriBuilder = $this->controllerContext->getUriBuilder();
     $returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('return_url');
     $uri = $uriBuilder->reset()->setTargetPageUid($conf['forwardPid'])->setLinkAccessRestrictedPages(true)->setNoCache(false)->setUseCacheHash(false)->setArguments(array('return_url' => $returnUrl, 'logintype' => 'login', 'pid' => $conf['feuserPid'], 'loginHash' => $loginHash))->uriFor($conf['forwardAction'], NULL, 'FrontendUser');
     $response = $this->objectManager->create('CIC\\Cicregister\\Behaviors\\Response\\RedirectURI');
     $response->setValue($uri);
     return $response;
 }
开发者ID:busynoggin,项目名称:cicregister,代码行数:18,代码来源:AuthenticateUser.php

示例3: decorate

 /**
  * @param array $decorators a list of decorators
  * @param $object the object to be decorated
  */
 public function decorate(array $decorators, $object)
 {
     foreach ($decorators as $decoratorClassName => $enabled) {
         if ($enabled == true || is_array($enabled) && $enabled['_typoScriptNodeValue'] == true) {
             if (is_array($enabled)) {
                 $conf = $enabled;
             } else {
                 $conf = array();
             }
             $decorator = $this->objectManager->create($decoratorClassName);
             $decorator->decorate($object, $conf);
         }
     }
 }
开发者ID:busynoggin,项目名称:cicregister,代码行数:18,代码来源:Decorator.php

示例4: convertDependenciesToObjects

 /**
  * @param string $dependencies
  * @return \SplObjectStorage
  */
 public function convertDependenciesToObjects($dependencies)
 {
     $unserializedDependencies = unserialize($dependencies);
     $dependenciesObject = new \SplObjectStorage();
     foreach ($unserializedDependencies as $dependencyType => $dependencyValues) {
         foreach ($dependencyValues as $dependency => $versions) {
             if ($dependencyType && $dependency) {
                 $versionNumbers = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionsStringToVersionNumbers($versions);
                 $lowest = $versionNumbers[0];
                 if (count($versionNumbers) === 2) {
                     $highest = $versionNumbers[1];
                 } else {
                     $highest = '';
                 }
                 /** @var $dependencyObject \TYPO3\CMS\Extensionmanager\Domain\Model\Dependency */
                 $dependencyObject = $this->objectManager->create('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Dependency');
                 $dependencyObject->setType($dependencyType);
                 $dependencyObject->setIdentifier($dependency);
                 $dependencyObject->setLowestVersion($lowest);
                 $dependencyObject->setHighestVersion($highest);
                 $dependenciesObject->attach($dependencyObject);
                 unset($dependencyObject);
             }
         }
     }
     return $dependenciesObject;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:31,代码来源:DependencyUtility.php

示例5: createMapperObject

 public function createMapperObject($extName)
 {
     $mapperName = '\\Nng\\Nnfesubmit\\Mapper\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($extName) . 'Mapper';
     if (class_exists($mapperName)) {
         return $this->objectManager->create($mapperName);
     }
     return false;
 }
开发者ID:99grad,项目名称:TYPO3.Extbase.nnfesubmit,代码行数:8,代码来源:MainController.php

示例6: execute

 /**
  * Function execute from the Scheduler
  *
  * @return boolean TRUE on successful execution, FALSE on error
  */
 public function execute()
 {
     list($extensionName, $controllerName, $commandName) = explode(':', $this->commandIdentifier);
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->injectObjectManager($objectManager);
     $request = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Request');
     $dispatcher = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Dispatcher');
     $response = $this->objectManager->create('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
     try {
         $upperCamelCaseExtensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($extensionName);
         $upperCamelCaseControllerName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($controllerName);
         // TODO build class name a different way now that we have namespaces
         // see https://www.pivotaltracker.com/story/show/73980994
         $controllerObjectName = sprintf('Tx_%s_Command_%sCommandController', $upperCamelCaseExtensionName, $upperCamelCaseControllerName);
         $request->setControllerCommandName($commandName);
         $request->setControllerObjectName($controllerObjectName);
         $request->setArguments((array) $this->arguments);
         $dispatcher->dispatch($request, $response);
         return TRUE;
     } catch (\Exception $e) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($e->getMessage(), $extensionName, $e->getCode());
         return FALSE;
     }
 }
开发者ID:electricretina,项目名称:cicbase,代码行数:29,代码来源:Task.php

示例7: createFile

 public function createFile(array $sourceData, $propertyPath, $allowedTypes, $maxSize)
 {
     $this->messages = new \TYPO3\CMS\Extbase\Error\Result();
     $this->propertyPath = $propertyPath;
     $key = $propertyPath ? $propertyPath : '';
     $this->settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
     $uploadedFileData = $this->getUploadedFileData();
     $this->handleUploadErrors($uploadedFileData);
     if ($this->messages->hasErrors()) {
         $this->fileRepository->clearHeld($key);
         return $this->messages->getFirstError();
     } else {
         if (!$this->settings['file']['dontValidateType']) {
             $this->validateType($uploadedFileData, $allowedTypes);
         }
         if (!$this->settings['file']['dontValidateName']) {
             $this->validateName($uploadedFileData);
         }
         if (!$this->settings['file']['dontValidateSize']) {
             $this->validateSize($uploadedFileData, $maxSize);
         }
     }
     if ($this->messages->hasErrors()) {
         $this->fileRepository->clearHeld($key);
         return $this->messages->getFirstError();
     } else {
         // ok to make a file object
         $pathInfo = pathinfo($uploadedFileData['tmp_name']);
         $fileObject = $this->objectManager->create('CIC\\Cicbase\\Domain\\Model\\File');
         $fileObject->setTitle($sourceData['title']);
         // TODO: Set a default title if it's not provided.
         $fileObject->setDescription($sourceData['description']);
         $fileObject->setIsSaved(false);
         $fileObject->setOwner($GLOBALS['TSFE']->fe_user->user['uid']);
         $fileObject->setSize($uploadedFileData['size']);
         $fileObject->setMimeType($uploadedFileData['type']);
         $fileObject->setOriginalFilename($uploadedFileData['name']);
         $fileObject->setPath($uploadedFileData['tmp_name']);
         $fileObject->setFilename($pathInfo['filename']);
         $fileObject->setCrdate(time());
         $results = $this->fileRepository->hold($fileObject, $key);
         return $results;
     }
 }
开发者ID:electricretina,项目名称:cicbase,代码行数:44,代码来源:FileFactory.php


注:本文中的TYPO3\CMS\Extbase\Object\ObjectManager::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。