Returns the value of the specified method argument
public getMethodArgument ( string $argumentName ) : mixed | ||
$argumentName | string | Name of the argument |
Résultat | mixed | Value of the argument |
/** * @Flow\Around("method(Neos\ContentRepository\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); }
/** * Add the current node and all parent identifiers to be used for cache entry tagging * * @Flow\Before("method(Neos\Flow\Mvc\Routing\RouterCachingService->extractUuids())") * @param 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); }); }
/** * Logs calls of destroy() * * @Flow\Before("within(Neos\Flow\Session\SessionInterface) && method(.*->destroy())") * @param JoinPointInterface $joinPoint The current joinpoint * @return mixed The result of the target method if it has not been intercepted */ public function logDestroy(JoinPointInterface $joinPoint) { $session = $joinPoint->getProxy(); if ($session->isStarted()) { $reason = $joinPoint->isMethodArgument('reason') ? $joinPoint->getMethodArgument('reason') : 'no reason given'; $this->systemLogger->log(sprintf('%s: Destroyed session with id %s: %s', $this->getClassName($joinPoint), $joinPoint->getProxy()->getId(), $reason), LOG_INFO); } }
/** * Convert the object to its context path, if we deal with ContentRepository nodes. * * @Flow\Around("method(Neos\Flow\Persistence\AbstractPersistenceManager->convertObjectToIdentityArray())") * @param JoinPointInterface $joinPoint the joinpoint * @return string|array the context path to be used for routing */ public function convertNodeToContextPathForRouting(JoinPointInterface $joinPoint) { $objectArgument = $joinPoint->getMethodArgument('object'); if ($objectArgument instanceof NodeInterface) { return $objectArgument->getContextPath(); } else { return $joinPoint->getAdviceChain()->proceed($joinPoint); } }
/** * @Flow\Around("setting(Neos.Neos.typoScript.enableObjectTreeCache) && method(Neos\Neos\Domain\Service\TypoScriptService->getMergedTypoScriptObjectTree())") * @param JoinPointInterface $joinPoint The current join point * @return mixed */ public function cacheGetMergedTypoScriptObjectTree(JoinPointInterface $joinPoint) { $currentSiteNode = $joinPoint->getMethodArgument('startNode'); $cacheIdentifier = str_replace('.', '_', $currentSiteNode->getContext()->getCurrentSite()->getSiteResourcesPackageKey()); if ($this->typoScriptCache->has($cacheIdentifier)) { $typoScriptObjectTree = $this->typoScriptCache->get($cacheIdentifier); } else { $typoScriptObjectTree = $joinPoint->getAdviceChain()->proceed($joinPoint); $this->typoScriptCache->set($cacheIdentifier, $typoScriptObjectTree); } return $typoScriptObjectTree; }
/** * Logs calls and result of isPrivilegeTargetGranted() * * @Flow\After("method(Neos\Flow\Security\Authorization\PrivilegeManager->isPrivilegeTargetGranted())") * @param JoinPointInterface $joinPoint * @return void */ public function logPrivilegeAccessDecisions(JoinPointInterface $joinPoint) { $decision = $joinPoint->getResult() === true ? 'GRANTED' : 'DENIED'; $message = sprintf('Decided "%s" on privilege "%s".', $decision, $joinPoint->getMethodArgument('privilegeTargetIdentifier')); $this->securityLogger->log($message, \LOG_INFO); }
/** * @Flow\Around("method(public Neos\Flow\Tests\Functional\Aop\Fixtures\TargetClass01->greet())") * @param JoinPointInterface $joinPoint * @return string */ public function changeNameArgumentAdvice(JoinPointInterface $joinPoint) { if ($joinPoint->getMethodArgument('name') === 'Andi') { $joinPoint->setMethodArgument('name', 'Robert'); } return $joinPoint->getAdviceChain()->proceed($joinPoint); }