本文整理汇总了PHP中TYPO3\Flow\Aop\JoinPointInterface类的典型用法代码示例。如果您正苦于以下问题:PHP JoinPointInterface类的具体用法?PHP JoinPointInterface怎么用?PHP JoinPointInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoinPointInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerDisableContentCache
/**
* Advice for a disabled content cache (e.g. because an exception was handled)
*
* @Flow\AfterReturning("method(TYPO3\TypoScript\Core\Cache\RuntimeContentCache->setEnableContentCache())")
* @param JoinPointInterface $joinPoint
*/
public function registerDisableContentCache(JoinPointInterface $joinPoint)
{
$enableContentCache = $joinPoint->getMethodArgument('enableContentCache');
if ($enableContentCache !== TRUE) {
$this->evaluatedUncached = TRUE;
}
}
示例2: rewriteSiteAssetCollection
/**
* @Flow\Before("method(TYPO3\Neos\Controller\Backend\ContentController->uploadAssetAction())")
* @param JoinPointInterface $joinPoint The current join point
* @return void
*/
public function rewriteSiteAssetCollection(JoinPointInterface $joinPoint)
{
if ($this->lookupNodeFilter === NULL || $this->lookupPropertyName === NULL) {
return;
}
/** @var ContentController $contentController */
$contentController = $joinPoint->getProxy();
/** @var ActionRequest $actionRequest */
$actionRequest = ObjectAccess::getProperty($contentController, 'request', TRUE);
$nodeContextPath = $actionRequest->getInternalArgument('__node');
if ($nodeContextPath === NULL) {
return;
}
$node = $this->propertyMapper->convert($nodeContextPath, NodeInterface::class);
$flowQuery = new FlowQuery(array($node));
/** @var NodeInterface $documentNode */
$documentNode = $flowQuery->closest($this->lookupNodeFilter)->get(0);
if (!$documentNode->hasProperty($this->lookupPropertyName)) {
return;
}
/** @var AssetCollection $assetCollection */
$assetCollection = $this->assetCollectionRepository->findByIdentifier($documentNode->getProperty($this->lookupPropertyName));
if ($assetCollection === NULL) {
return;
}
/** @var Asset $asset */
$asset = $joinPoint->getMethodArgument('asset');
$assetCollection->addAsset($asset);
$this->assetCollectionRepository->update($assetCollection);
}
示例3: aroundConvertRequestPathToNodeAspect
/**
* @Flow\Around("method(TYPO3\Neos\Routing\FrontendNodeRoutePartHandler->convertRequestPathToNode())")
*
* @param \TYPO3\FLOW\AOP\JoinPointInterface $joinPoint the join point
*
* @return mixed
*/
public function aroundConvertRequestPathToNodeAspect($joinPoint)
{
if ($this->nodeNotFoundService->isEnabled()) {
/** @var NodeInterface $node */
$requestPath = $joinPoint->getMethodArgument('requestPath');
try {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
} catch (InvalidRequestPathException $e) {
$defaultUriSegment = $this->nodeNotFoundService->getDefaultUriSegment();
$requestPath = $defaultUriSegment . $this->nodeNotFoundService->get404NodeUriForDimensionUriSegment($defaultUriSegment);
$joinPoint->setMethodArgument("requestPath", $requestPath);
return $joinPoint->getAdviceChain()->proceed($joinPoint);
} catch (NoSuchDimensionValueException $e) {
$defaultUriSegment = $this->nodeNotFoundService->getDefaultUriSegment();
$requestPath = $defaultUriSegment . $this->nodeNotFoundService->get404NodeUriForDimensionUriSegment($defaultUriSegment);
$joinPoint->setMethodArgument("requestPath", $requestPath);
return $joinPoint->getAdviceChain()->proceed($joinPoint);
} catch (NoSuchNodeException $e) {
$dimensionUriSegment = strstr($requestPath, "/", true);
if (count($this->contentDimensionPresetSource->getAllPresets()) > 0) {
$requestPath = $dimensionUriSegment . "/" . $this->nodeNotFoundService->get404NodeUriForDimensionUriSegment($dimensionUriSegment);
} else {
$requestPath = $this->nodeNotFoundService->get404NodeUriForDimensionUriSegment('');
}
$joinPoint->setMethodArgument("requestPath", $requestPath);
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
} else {
// execute the original code
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
}
示例4: replaceNodeData
/**
* @Flow\Around("method(TYPO3\TYPO3CR\Domain\Model\Workspace->replaceNodeData())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return string The result of the target method if it has not been intercepted
*/
public function replaceNodeData(JoinPointInterface $joinPoint)
{
/** @var Node $node */
$node = $joinPoint->getMethodArgument('node');
if ($node->isRemoved()) {
// If the node is supposed to be removed, we do not need to do anything as the node will be gone anyways afterwards
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
/** @var NodeData $targetNodeData */
$targetNodeData = $joinPoint->getMethodArgument('targetNodeData');
$commentsForToBePublishedNode = $this->extractComments($node);
$commentsInTargetWorkspace = $this->extractComments($targetNodeData);
// Call original Method
$result = $joinPoint->getAdviceChain()->proceed($joinPoint);
if (count($commentsForToBePublishedNode) == 0 && count($commentsInTargetWorkspace) == 0) {
return $result;
}
// After publishing the node, we update the published node with the merged comments. We cannot do this
// before publishing, as otherwise the NodeData which is underneath the to-be-published Node will be "dirty"
// and marked as "removed" at the same time, leading to a CR crash. This also is a CR bug which only occurs in
// very rare occasions.
$mergedComments = $this->mergeComments($commentsForToBePublishedNode, $commentsInTargetWorkspace);
$this->writeComments($node, $mergedComments);
return $result;
}
示例5: addCurrentNodeIdentifier
/**
* Add the current node and all parent identifiers to be used for cache entry tagging
*
* @Flow\Before("method(TYPO3\Flow\Mvc\Routing\RouterCachingService->extractUuids())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return void
*/
public function addCurrentNodeIdentifier(JoinPointInterface $joinPoint)
{
$values = $joinPoint->getMethodArgument('values');
if (!isset($values['node']) || strpos($values['node'], '@') === false) {
return;
}
// Build context explicitly without authorization checks because the security context isn't available yet
// anyway and any Entity Privilege targeted on Workspace would fail at this point:
$this->securityContext->withoutAuthorizationChecks(function () use($joinPoint, $values) {
$contextPathPieces = NodePaths::explodeContextPath($values['node']);
$context = $this->contextFactory->create(['workspaceName' => $contextPathPieces['workspaceName'], 'dimensions' => $contextPathPieces['dimensions'], 'invisibleContentShown' => true]);
$node = $context->getNode($contextPathPieces['nodePath']);
if (!$node instanceof NodeInterface) {
return;
}
$values['node-identifier'] = $node->getIdentifier();
$node = $node->getParent();
$values['node-parent-identifier'] = array();
while ($node !== null) {
$values['node-parent-identifier'][] = $node->getIdentifier();
$node = $node->getParent();
}
$joinPoint->setMethodArgument('values', $values);
});
}
示例6: initialize
/**
* Before advice, making sure we initialize before use.
*
* This expects $proxy->Flow_Persistence_LazyLoadingObject_thawProperties
* to be a Closure that populates the object. That variable is unset after
* initializing the object!
*
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return void
* @Flow\Before("TYPO3\Flow\Persistence\Generic\Aspect\LazyLoadingObjectAspect->needsLazyLoadingObjectAspect && !method(.*->__construct())")
*/
public function initialize(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
$proxy = $joinPoint->getProxy();
if (property_exists($proxy, 'Flow_Persistence_LazyLoadingObject_thawProperties') && $proxy->Flow_Persistence_LazyLoadingObject_thawProperties instanceof \Closure) {
$proxy->Flow_Persistence_LazyLoadingObject_thawProperties->__invoke($proxy);
unset($proxy->Flow_Persistence_LazyLoadingObject_thawProperties);
}
}
示例7: rewriteJsonApiOrgMediaTypeToJson
/**
* @Flow\Around("within(TYPO3\Flow\Property\TypeConverter\MediaTypeConverterInterface) && method(.*->convertMediaType())")
* @param JoinPointInterface $joinPoint The current joinpoint
* @return mixed
*/
public function rewriteJsonApiOrgMediaTypeToJson(JoinPointInterface $joinPoint)
{
$mediaType = $joinPoint->getMethodArgument('mediaType');
if (strpos($mediaType, 'application/vnd.api+json') !== false) {
$joinPoint->setMethodArgument('mediaType', 'application/json');
}
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
示例8: registerDisableContentCache
/**
* Advice for a disabled content cache (e.g. because an exception was handled)
*
* @Flow\AfterReturning("method(TYPO3\TypoScript\Core\Cache\RuntimeContentCache->setEnableContentCache())")
* @param JoinPointInterface $joinPoint
*/
public function registerDisableContentCache(JoinPointInterface $joinPoint)
{
$enableContentCache = $joinPoint->getMethodArgument('enableContentCache');
if ($enableContentCache !== TRUE) {
$this->logger->log('Varnish cache disabled due content cache being disabled (e.g. because an exception was handled)', LOG_DEBUG);
$this->evaluatedUncached = TRUE;
}
}
示例9: filterNodeByAllowedSites
/**
* Check if nodetype is in allowed sites (apply node context by filtering out not allowed node types)
*
* @param \TYPO3\Flow\AOP\JoinPointInterface $joinPoint
* @Flow\Around("method(TYPO3\TYPO3CR\Domain\Factory\NodeFactory->filterNodeByContext(.*))")
* @return \TYPO3\TYPO3CR\Domain\Model\NodeInterface|NULL
*/
public function filterNodeByAllowedSites($joinPoint)
{
if ($this->isNodeTypeInAllowedSite($joinPoint->getMethodArgument('node')->getNodeType()) == FALSE) {
return null;
}
$result = $joinPoint->getAdviceChain()->proceed($joinPoint);
return $result;
}
示例10: addDqlFunction
/**
* Add DQL function
*
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @Flow\Before("method(TYPO3\Flow\Persistence\Doctrine\Service->runDql())")
* @return void
*/
public function addDqlFunction(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
$entityManager = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($joinPoint->getProxy(), 'entityManager', TRUE);
$configuration = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($entityManager, 'config', TRUE);
$configuration->addCustomStringFunction('DAY', 'Lelesys\\Plugin\\News\\Doctrine\\Query\\Mysql\\Day');
$configuration->addCustomStringFunction('MONTH', 'Lelesys\\Plugin\\News\\Doctrine\\Query\\Mysql\\Month');
$configuration->addCustomStringFunction('YEAR', 'Lelesys\\Plugin\\News\\Doctrine\\Query\\Mysql\\Year');
}
示例11: preventContentElementWraps
/**
* Makes sure that XML content (such as the RSS feed) is not wrapped with divs.
*
* @param JoinPointInterface $joinPoint
* @return string
* @Flow\Around("method(TYPO3\Neos\Service\ContentElementWrappingService->wrapContentObject())")
*/
public function preventContentElementWraps(JoinPointInterface $joinPoint)
{
$content = $joinPoint->getMethodArgument('content');
if (substr($content, 0, 5) === '<?xml') {
return $content;
}
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
示例12: replaceCommandWithDomainCommand
/**
* @param JoinPointInterface $joinPoint
* @return mixed Result of the target method
* @Flow\Around("class(TYPO3\Flow\Cli\Request) && method(.*->getCommand())")
*/
public function replaceCommandWithDomainCommand(JoinPointInterface $joinPoint)
{
/** @var Request $proxy */
$proxy = $joinPoint->getProxy();
if ($proxy->getControllerObjectName() === DomainCommandController::class) {
ObjectAccess::setProperty($proxy, 'command', $this->buildDomainCommand($proxy->getControllerCommandName()), TRUE);
}
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
示例13: enrichNodeTypeConfiguration
/**
* @Flow\Around("method(TYPO3\TYPO3CR\Domain\Model\NodeType->__construct())")
* @return void
*/
public function enrichNodeTypeConfiguration(JoinPointInterface $joinPoint)
{
$configuration = $joinPoint->getMethodArgument('configuration');
$nodeTypeName = $joinPoint->getMethodArgument('name');
$this->addEditorDefaultsToNodeTypeConfiguration($nodeTypeName, $configuration);
$this->addLabelsToNodeTypeConfiguration($nodeTypeName, $configuration);
$joinPoint->setMethodArgument('configuration', $configuration);
$joinPoint->getAdviceChain()->proceed($joinPoint);
}
开发者ID:testbird,项目名称:neos-development-collection,代码行数:13,代码来源:NodeTypeConfigurationEnrichmentAspect.php
示例14: convertNodeToContextPathForRouting
/**
* Convert the object to its context path, if we deal with TYPO3CR nodes.
*
* @Flow\Around("method(TYPO3\Flow\Persistence\AbstractPersistenceManager->convertObjectToIdentityArray())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint the joinpoint
* @return string|array the context path to be used for routing
*/
public function convertNodeToContextPathForRouting(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
$objectArgument = $joinPoint->getMethodArgument('object');
if ($objectArgument instanceof NodeInterface) {
return $objectArgument->getContextPath();
} else {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
}
示例15: dontResolveShortcutsInFrontend
/**
* @Flow\Around("method(TYPO3\Neos\Controller\Frontend\NodeController->handleShortcutNode())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return void
*/
public function dontResolveShortcutsInFrontend(JoinPointInterface $joinPoint)
{
$node = $joinPoint->getMethodArgument('node');
if ($node instanceof NodeInterface) {
if (in_array($node->getProperty('targetMode'), $this->legitShortcutTargets)) {
$joinPoint->getAdviceChain()->proceed($joinPoint);
}
}
}