本文整理汇总了PHP中TYPO3\Flow\Aop\JoinPointInterface::getProxy方法的典型用法代码示例。如果您正苦于以下问题:PHP JoinPointInterface::getProxy方法的具体用法?PHP JoinPointInterface::getProxy怎么用?PHP JoinPointInterface::getProxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Aop\JoinPointInterface
的用法示例。
在下文中一共展示了JoinPointInterface::getProxy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logFinishServiceCall
/**
* Logs calls
*
* @Flow\After("method(PerfectIn\Api\Webservice\WebserviceCall->invoke())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current joinpoint
*/
public function logFinishServiceCall(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
$callIdentifier = $joinPoint->getProxy()->getClass() . '::' . $joinPoint->getProxy()->getMethod();
if ($joinPoint->hasException()) {
$this->logger->log($this->logIdentifier . ' - error - ' . $joinPoint->getException()->getMessage() . '(' . $joinPoint->getException()->getCode() . ')', LOG_ERR);
} else {
$this->logger->log($this->logIdentifier . ' - response - ' . $this->getLogMessageForVariable($joinPoint->getResult()), LOG_INFO);
}
}
示例2: callMethodOnOriginalSessionObject
/**
* Around advice, wrapping every method of a scope session object. It redirects
* all method calls to the session object once there is one.
*
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
* @return mixed
* @Flow\Around("filter(TYPO3\Flow\Session\Aspect\SessionObjectMethodsPointcutFilter)")
*/
public function callMethodOnOriginalSessionObject(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$proxy = $joinPoint->getProxy();
if (!isset($this->sessionOriginalInstances[$objectName])) {
$this->sessionOriginalInstances[$objectName] = $this->objectManager->get($objectName);
}
if ($this->sessionOriginalInstances[$objectName] === $proxy) {
return $joinPoint->getAdviceChain()->proceed($joinPoint);
} else {
return call_user_func_array(array($this->sessionOriginalInstances[$objectName], $methodName), $joinPoint->getMethodArguments());
}
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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');
}
示例6: 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);
}
示例7: catchAddAttribute
/**
* This changes how TagBuilder->addAttribute() method works.
* When attribute's value is NULL or FALSE, it does *unset* the value.
* Otherwise addAttribute() method is called as usually.
*
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint
* @Flow\Around("method(TYPO3\Fluid\Core\ViewHelper\TagBuilder->addAttribute())")
* @return void
*/
public function catchAddAttribute(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
if (null === $joinPoint->getMethodArgument('attributeValue') || false === $joinPoint->getMethodArgument('attributeValue')) {
/** @var \TYPO3\Fluid\Core\ViewHelper\TagBuilder $tagBuilder */
$tagBuilder = $joinPoint->getProxy();
$tagBuilder->removeAttribute($joinPoint->getMethodArgument('attributeName'));
} else {
$joinPoint->getAdviceChain()->proceed($joinPoint);
}
}
示例8: enhanceMatchRequest
/**
* @Flow\Around("method(Flowpack\Neos\FrontendLogin\Security\NeosRequestPattern->matchRequest())")
* @param JoinPointInterface $joinPoint
* @return boolean
*/
public function enhanceMatchRequest(JoinPointInterface $joinPoint)
{
$request = $joinPoint->getMethodArgument('request');
$requestPath = $request->getHttpRequest()->getUri()->getPath();
if ($joinPoint->getProxy()->getPattern() === NeosRequestPattern::PATTERN_BACKEND) {
if (strpos($requestPath, '/che!') === 0) {
return true;
}
}
return $joinPoint->getAdviceChain()->proceed($joinPoint);
}
开发者ID:skurfuerst,项目名称:PackageFactory.Guevara,代码行数:16,代码来源:FlowpackFrontendLoginCompatibilityAspect.php
示例9: registerEvaluateUncached
/**
* Advice for uncached segments when rendering from a cached version
*
* @Flow\AfterReturning("method(TYPO3\TypoScript\Core\Cache\RuntimeContentCache->evaluateUncached())")
* @param JoinPointInterface $joinPoint
*/
public function registerEvaluateUncached(JoinPointInterface $joinPoint)
{
$path = $joinPoint->getMethodArgument('path');
$proxy = $joinPoint->getProxy();
/** @var Runtime $runtime */
$runtime = ObjectAccess::getProperty($proxy, 'runtime', TRUE);
$mocVarnishIgnoreUncached = $runtime->evaluate($path . '/__meta/cache/mocVarnishIgnoreUncached');
if ($mocVarnishIgnoreUncached !== TRUE) {
$this->evaluatedUncached = TRUE;
}
}
示例10: registerEvaluateUncached
/**
* Advice for uncached segments when rendering from a cached version
*
* @Flow\AfterReturning("method(TYPO3\TypoScript\Core\Cache\RuntimeContentCache->evaluateUncached())")
* @param JoinPointInterface $joinPoint
*/
public function registerEvaluateUncached(JoinPointInterface $joinPoint)
{
$path = $joinPoint->getMethodArgument('path');
$proxy = $joinPoint->getProxy();
/** @var Runtime $runtime */
$runtime = ObjectAccess::getProperty($proxy, 'runtime', TRUE);
$mocVarnishIgnoreUncached = $runtime->evaluate($path . '/__meta/cache/mocVarnishIgnoreUncached');
if ($mocVarnishIgnoreUncached !== TRUE) {
$this->logger->log(sprintf('Varnish cache disabled due to uncached path "%s" (can be prevented using "mocVarnishIgnoreUncached")', $path . '/__meta/cache/mocVarnishIgnoreUncached'), LOG_DEBUG);
$this->evaluatedUncached = TRUE;
}
}
示例11: bruteForceAccountLocking
/**
* @Flow\AfterReturning("method(TYPO3\Flow\Security\Account->authenticationAttempted())")
* @param JoinPointInterface $joinPoint
* @return void
*/
public function bruteForceAccountLocking(JoinPointInterface $joinPoint)
{
$failedAttemptsThreshold = intval($this->settings['failedAttemptsThreshold']);
if ($failedAttemptsThreshold === 0) {
return;
}
/** @var \TYPO3\Flow\Security\Account $account */
$account = $joinPoint->getProxy();
// Deactivate account if failed attempts exceed threshold
if ($account->getFailedAuthenticationCount() >= $failedAttemptsThreshold) {
$account->setExpirationDate(new \DateTime());
$this->sendNotificationMail($account);
}
}
示例12: extendContextWithMetaDataRootNode
/**
* @param JoinPointInterface $joinPoint
* @Flow\After("method(TYPO3\TypoScript\Core\Runtime->pushContextArray())")
* @return void
*/
public function extendContextWithMetaDataRootNode(JoinPointInterface $joinPoint)
{
/** @var \TYPO3\TypoScript\Core\Runtime $runtime */
$runtime = $joinPoint->getProxy();
$currentContext = $runtime->getCurrentContext();
if (isset($currentContext['node'])) {
/** @var \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node */
$node = $currentContext['node'];
$metaDataRootNode = $this->nodeService->findOrCreateMetaDataRootNode($node->getContext());
$currentContext = $runtime->popContext();
$currentContext[MetaDataRepository::METADATA_ROOT_NODE_NAME] = $metaDataRootNode;
$runtime->pushContextArray($currentContext);
}
}
示例13: getResponseFromCache
/**
* @Flow\Around("setting(Ttree.Embedly.logApiRequest) && within(Ttree\Embedly\Embedly) && method(public .*->(oembed|preview|objectify|extract|services)())")
* @param JoinPointInterface $joinPoint The current join point
* @return mixed
*/
public function getResponseFromCache(JoinPointInterface $joinPoint)
{
$proxy = $joinPoint->getProxy();
$key = ObjectAccess::getProperty($proxy, 'key');
$params = $joinPoint->getMethodArgument('params');
$cacheKey = md5($joinPoint->getClassName() . $joinPoint->getMethodName() . $key . json_encode($params));
if ($this->responseCache->has($cacheKey)) {
$this->systemLogger->log(sprintf(' cache hit Embedly::%s', $joinPoint->getMethodName()), LOG_DEBUG);
return $this->responseCache->get($cacheKey);
} else {
$this->systemLogger->log(sprintf(' cache miss Embedly::%s', $joinPoint->getMethodName()), LOG_DEBUG);
}
$response = $joinPoint->getAdviceChain()->proceed($joinPoint);
$this->responseCache->set($cacheKey, $response);
return $response;
}
示例14: logManagerLogout
/**
* Logs calls and results of the logout() method of the Authentication Manager
*
* @Flow\AfterReturning("within(TYPO3\Flow\Security\Authentication\AuthenticationManagerInterface) && method(.*->logout())")
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current joinpoint
* @return mixed The result of the target method if it has not been intercepted
*/
public function logManagerLogout(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
/** @var $securityContext \TYPO3\Flow\Security\Context */
$securityContext = $joinPoint->getProxy()->getSecurityContext();
if (!$securityContext->isInitialized()) {
return;
}
$accountIdentifiers = array();
foreach ($securityContext->getAuthenticationTokens() as $token) {
/** @var $account \TYPO3\Flow\Security\Account */
$account = $token->getAccount();
if ($account !== NULL) {
$accountIdentifiers[] = $account->getAccountIdentifier();
}
}
$this->securityLogger->log('Logged out ' . count($accountIdentifiers) . ' account(s). (' . implode(', ', $accountIdentifiers) . ')', LOG_INFO);
}
示例15: logManagerLogout
/**
* Logs calls and results of the logout() method of the Authentication Manager
*
* @Flow\AfterReturning("within(TYPO3\Flow\Security\Authentication\AuthenticationManagerInterface) && method(.*->logout())")
* @param JoinPointInterface $joinPoint The current joinpoint
* @return mixed The result of the target method if it has not been intercepted
*/
public function logManagerLogout(JoinPointInterface $joinPoint)
{
/** @var AuthenticationManagerInterface $authenticationManager */
$authenticationManager = $joinPoint->getProxy();
$securityContext = $authenticationManager->getSecurityContext();
if (!$securityContext->isInitialized()) {
return;
}
$accountIdentifiers = array();
foreach ($securityContext->getAuthenticationTokens() as $token) {
/** @var $account Account */
$account = $token->getAccount();
if ($account !== null) {
$accountIdentifiers[] = $account->getAccountIdentifier();
}
}
$this->securityLogger->log(sprintf('Logged out %d account(s). (%s)', count($accountIdentifiers), implode(', ', $accountIdentifiers)), LOG_INFO);
}