本文整理汇总了PHP中TYPO3\CMS\Extbase\Object\ObjectManagerInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerInterface类的具体用法?PHP ObjectManagerInterface怎么用?PHP ObjectManagerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectManagerInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doUpdate
/**
* Do the language pack update
*
* @param string $extensionKey: extension key of the language pack
* @return void
*/
public function doUpdate($extensionKey)
{
$extPath = ExtensionManagementUtility::extPath($extensionKey);
$fileContent = explode(LF, GeneralUtility::getUrl($extPath . 'ext_tables_static+adt.sql'));
// SQL parser was moved from core to dbal in TYPO3 CMS 7.5
if (is_object($GLOBALS['TYPO3_DB']->SQLparser)) {
$sqlParser = $GLOBALS['TYPO3_DB']->SQLparser;
} else {
$sqlParser = $this->objectManager->get('SJBR\\StaticInfoTables\\Database\\SqlParser');
}
foreach ($fileContent as $line) {
$line = trim($line);
if ($line && preg_match('#^UPDATE#i', $line)) {
$parsedResult = $sqlParser->parseSQL($line);
// WHERE clause
$whereClause = $sqlParser->compileWhereClause($parsedResult['WHERE']);
// Fields
$fields = array();
foreach ($parsedResult['FIELDS'] as $fN => $fV) {
$fields[$fN] = $fV[0];
}
$res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($parsedResult['TABLE'], $whereClause, $fields, TRUE);
}
}
}
示例2: __construct
/**
* CONSTRUCTOR
*/
public function __construct()
{
$this->injectObjectManager(GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'));
$this->injectConfigurationService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService'));
$this->injectRecordService($this->objectManager->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService'));
$this->cache = $this->objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager', $this->objectManager)->getCache('flux');
}
示例3: initAttachments
/**
* Converts HTML-array to an object
* @param array $attachments
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function initAttachments(array $attachments)
{
/* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Attachment */
$objAttachments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
foreach ($attachments as $attachmentID => $attachment) {
if ($attachment['name'] == '') {
continue;
}
$attachmentObj = $this->objectManager->get('Mittwald\\Typo3Forum\\Domain\\Model\\Forum\\Attachment');
$tmp_name = $_FILES['tx_typo3forum_pi1']['tmp_name']['attachments'][$attachmentID];
$mime_type = mime_content_type($tmp_name);
//Save in ObjectStorage and in file system
$attachmentObj->setFilename($attachment['name']);
$attachmentObj->setRealFilename(sha1($attachment['name'] . time()));
$attachmentObj->setMimeType($mime_type);
//Create dir if not exists
$tca = $attachmentObj->getTCAConfig();
$path = $tca['columns']['real_filename']['config']['uploadfolder'];
if (!file_exists($path)) {
mkdir($path, '0777', true);
}
//upload file and put in object storage
$res = \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move($tmp_name, $attachmentObj->getAbsoluteFilename());
if ($res === true) {
$objAttachments->attach($attachmentObj);
}
}
return $objAttachments;
}
示例4: getPostRepository
/**
* Get postRepository
*
* @return \TYPO3\T3extblog\Domain\Repository\PostRepository
*/
protected function getPostRepository()
{
if ($this->postRepository === NULL) {
$this->postRepository = $this->objectManager->get('TYPO3\\T3extblog\\Domain\\Repository\\PostRepository');
}
return $this->postRepository;
}
示例5: __construct
/**
* Constructor
*/
public function __construct()
{
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->injectObjectManager($objectManager);
$configurationService = $this->objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService');
$this->injectConfigurationService($configurationService);
}
示例6: userFunc
/**
* User function
*
* @return string
*/
public function userFunc()
{
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$this->injectDocCommentParser($this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\DocCommentParser::class));
$this->injectReflectionService($this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class));
return $this->generateDocbook(\TYPO3\CMS\Fluid\ViewHelpers::class);
}
示例7: getInstance
/**
* Returns an instance of pager for a given configuration builder and a pager configuration
*
* @param Tx_PtExtlist_Domain_Configuration_Pager_PagerConfig $pagerConfiguration
* @return Tx_PtExtlist_Domain_Model_Pager_PagerInterface
*/
public function getInstance(Tx_PtExtlist_Domain_Configuration_Pager_PagerConfig $pagerConfiguration)
{
$pagerClassName = $pagerConfiguration->getPagerClassName();
$pager = $this->objectManager->get($pagerClassName, $pagerConfiguration);
Tx_PtExtbase_Assertions_Assert::isTrue(is_a($pager, 'Tx_PtExtlist_Domain_Model_Pager_PagerInterface'), array('message' => 'Given pager class does not implement pager interface! 1279541488'));
return $pager;
}
示例8: __construct
/**
* Constructor
*/
public function __construct()
{
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->injectConfigurationService($this->objectManager->get(ConfigurationService::class));
$this->injectPageService($this->objectManager->get(PageService::class));
$this->injectWorkspacesAwareRecordService($this->objectManager->get(WorkspacesAwareRecordService::class));
}
示例9: initTags
/**
* Converts string of tags to an object
* @param string $tags
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function initTags($tags)
{
/* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Tag */
$objTags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$tagArray = array_unique(explode(',', $tags));
foreach ($tagArray as $tagName) {
$tagName = ucfirst(trim($tagName));
if ($tagName == "") {
continue;
}
$searchResult = $this->tagRepository->findTagWithSpecificName($tagName);
if ($searchResult[0] != false) {
$searchResult[0]->increaseTopicCount();
$objTags->attach($searchResult[0]);
} else {
/* @var \Mittwald\Typo3Forum\Domain\Model\Forum\Tag $tag */
$tag = $this->objectManager->get('Mittwald\\Typo3Forum\\Domain\\Model\\Forum\\Tag');
$tag->setName($tagName);
$tag->setCrdate(new \DateTime());
$tag->increaseTopicCount();
$objTags->attach($tag);
}
}
return $objTags;
}
示例10: initializeEnvironment
protected function initializeEnvironment()
{
/**
* @var ConfigurationManager $configurationManager
* @var ContentObjectRenderer $contentObjectRenderer
*/
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$this->configurationManager =& $configurationManager;
$contentObjectRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$this->configurationManager->setContentObject($contentObjectRenderer);
$this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
if (empty($GLOBALS['TSFE']->sys_page)) {
$GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
}
if (empty($GLOBALS['TSFE']->tmpl)) {
$GLOBALS['TSFE']->initTemplate();
}
if (!isset($GLOBALS['TSFE']->config)) {
$GLOBALS['TSFE']->config = array();
}
if (empty($GLOBALS['TSFE']->config['config'])) {
$GLOBALS['TSFE']->config['config'] = array();
$GLOBALS['TSFE']->config['config']['tx_realurl_enable'] = TRUE;
$GLOBALS['TSFE']->config['mainScript'] = 'index.php';
}
}
示例11: process
/**
* The main method called by the controller
*
* @param array $field
* @param integer $form
* @param object $mail
* @param Tx_Powermail_Controller_FormsController $pObj
*
* @return string
*/
public function process($field, $form, $mail, $pObj)
{
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$data = array();
return '';
// TODO create fe_user
// TODO check if user exists, but not here, new signal slot?
// Check Lookups
// Use sp_powermail signal finisher
if (is_array($field) && count($field) > 0) {
foreach ($field as $uid => $value) {
if (is_numeric($uid)) {
$fieldsRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Powermail_Domain_Repository_FieldsRepository');
$row = $fieldsRepository->findByUid($uid);
if ('sharepoint' == $row->getType()) {
$mappingAttributeRepository = $this->objectManager->get('Aijko\\SharepointConnector\\Domain\\Repository\\Mapping\\AttributeRepository');
$sharepointAttribute = $mappingAttributeRepository->findByUid($row->getSharepointAttribute());
$data[$row->getSharepointList()][$sharepointAttribute->getTypo3FieldName()] = $value;
}
}
}
// Store data
$sharepointListsRepository = $this->objectManager->get('Aijko\\SharepointConnector\\Domain\\Repository\\Sharepoint\\ListsRepository');
$result = $sharepointListsRepository->addToMultipleLists($data);
if (!$result) {
// TODO error handling
// result = array with sharepoint result
}
}
}
示例12: create
/**
* Creates a ResolverHandler by given $name
*
* @param string $handlerName Name of the resolver handler to create
* @param ResolverHandlerInterface $nextHandler Next handler for the resolver
*
* @return ResolverHandlerInterface
*/
public function create($handlerName, ResolverHandlerInterface $nextHandler = null)
{
if (is_null($nextHandler)) {
return $this->objectManager->get($handlerName);
}
return $this->objectManager->get($handlerName, $nextHandler);
}
示例13: __construct
/**
* Constructor
*/
public function __construct()
{
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->configurationService = $this->objectManager->get('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService');
$this->pageService = $this->objectManager->get('FluidTYPO3\\Fluidpages\\Service\\PageService');
$this->recordService = $this->objectManager->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService');
}
示例14: userFunc
/**
* User function
*
* @return string
*/
public function userFunc()
{
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->injectDocCommentParser($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\DocCommentParser'));
$this->injectReflectionService($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService'));
return $this->generateDocbook('TYPO3\\CMS\\Fluid\\ViewHelpers');
}
示例15: build
/**
* Builds a CLI request object from a command line.
*
* The given command line may be a string (e.g. "myextension:foo do-that-thing --force") or
* an array consisting of the individual parts. The array must not include the script
* name (like in $argv) but start with command right away.
*
* @param mixed $commandLine The command line, either as a string or as an array
* @param string $callingScript The calling script (usually ./typo3/cli_dispatch.phpsh)
* @return \TYPO3\CMS\Extbase\Mvc\Cli\Request The CLI request as an object
*/
public function build($commandLine = '', $callingScript = './typo3/cli_dispatch.phpsh extbase')
{
$request = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class);
$request->setCallingScript($callingScript);
$request->setControllerObjectName(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
$rawCommandLineArguments = is_array($commandLine) ? $commandLine : explode(' ', $commandLine);
if (empty($rawCommandLineArguments)) {
$request->setControllerCommandName('helpStub');
return $request;
}
$commandIdentifier = trim(array_shift($rawCommandLineArguments));
try {
$command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
$this->configurationManager->setConfiguration(array('extensionName' => $command->getExtensionName()));
} catch (\TYPO3\CMS\Extbase\Mvc\Exception\CommandException $exception) {
$request->setArgument('exception', $exception);
$request->setControllerCommandName('error');
return $request;
}
$controllerObjectName = $command->getControllerClassName();
$controllerCommandName = $command->getControllerCommandName();
$request->setControllerObjectName($controllerObjectName);
$request->setControllerCommandName($controllerCommandName);
list($commandLineArguments, $exceedingCommandLineArguments) = $this->parseRawCommandLineArguments($rawCommandLineArguments, $controllerObjectName, $controllerCommandName);
$request->setArguments($commandLineArguments);
$request->setExceedingArguments($exceedingCommandLineArguments);
return $request;
}