getProxy() public method

Returns the reference to the proxy class instance
public getProxy ( ) : Neos\Flow\ObjectManagement\Proxy\ProxyInterface
return Neos\Flow\ObjectManagement\Proxy\ProxyInterface
 /**
  * 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 JoinPointInterface $joinPoint The current join point
  * @return void
  * @Flow\Before("Neos\Flow\Persistence\Generic\Aspect\LazyLoadingObjectAspect->needsLazyLoadingObjectAspect && !method(.*->__construct())")
  */
 public function initialize(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);
     }
 }
Example #2
0
 /**
  * @param JoinPointInterface $joinPoint
  * @param string $profilePath
  * @return ProfileInterface
  */
 protected function profile(JoinPointInterface $joinPoint, $profilePath)
 {
     /** @var PaletteInterface $proxy */
     $proxy = $joinPoint->getProxy();
     try {
         $profile = ObjectAccess::getProperty($proxy, 'profile', TRUE);
     } catch (\Exception $exception) {
         // Getting the profile will fail on the CMYK palette as the profile property is private and as the class
         // has to be reflected this private property will be on the _Original class and not on the proxy class and
         // is as such not accessible for property_exists in ObjectAccess::getProperty
         // @see NEOS-423
         return $this->createAndSetProfileOnProxy($proxy, $profilePath);
     }
     if (!$profile instanceof ProfileInterface) {
         $profile = $this->createAndSetProfileOnProxy($proxy, $profilePath);
     }
     return $profile;
 }
 /**
  * Logs calls and results of the logout() method of the Authentication Manager
  *
  * @Flow\AfterReturning("within(Neos\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 = [];
     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);
 }
 /**
  * @Flow\Around("method(Neos\Flow\Mvc\Routing\UriBuilder->uriFor())")
  * @param \Neos\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return string The result of the target method if it has not been intercepted
  */
 public function rewritePluginViewUris(JoinPointInterface $joinPoint)
 {
     /** @var ActionRequest $request */
     $request = $joinPoint->getProxy()->getRequest();
     $arguments = $joinPoint->getMethodArguments();
     $currentNode = $request->getInternalArgument('__node');
     if (!$request->getMainRequest()->hasArgument('node') || !$currentNode instanceof Node) {
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     }
     $currentNode = $request->getInternalArgument('__node');
     $controllerObjectName = $this->getControllerObjectName($request, $arguments);
     $actionName = $arguments['actionName'] !== null ? $arguments['actionName'] : $request->getControllerActionName();
     $targetNode = $this->pluginService->getPluginNodeByAction($currentNode, $controllerObjectName, $actionName);
     // TODO override namespace
     $q = new FlowQuery(array($targetNode));
     $pageNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
     $result = $this->generateUriForNode($request, $joinPoint, $pageNode);
     return $result;
 }
 /**
  * Mark object as cloned after cloning.
  *
  * Note: this is not used by anything in the Flow base distribution,
  * but might be needed by custom backends (like Neos.CouchDB).
  *
  * @param JoinPointInterface $joinPoint
  * @return void
  * @Flow\AfterReturning("Neos\Flow\Persistence\Aspect\PersistenceMagicAspect->isEntityOrValueObject && method(.*->__clone())")
  */
 public function cloneObject(JoinPointInterface $joinPoint)
 {
     $joinPoint->getProxy()->Flow_Persistence_clone = true;
 }
 /**
  * @Flow\AfterReturning("method(Neos\Flow\Tests\Functional\Aop\Fixtures\TargetClass02->publicTargetMethod())")
  * @param JoinPointInterface $joinPoint
  * @return string
  */
 public function anAfterReturningAdvice(JoinPointInterface $joinPoint)
 {
     $joinPoint->getProxy()->afterReturningAdviceWasInvoked = true;
 }
 /**
  * Logs calls of renewId()
  *
  * @Flow\Around("within(Neos\Flow\Session\SessionInterface) && method(.*->renewId())")
  * @param JoinPointInterface $joinPoint The current joinpoint
  * @return mixed The result of the target method if it has not been intercepted
  */
 public function logRenewId(JoinPointInterface $joinPoint)
 {
     $session = $joinPoint->getProxy();
     $oldId = $session->getId();
     $newId = $joinPoint->getAdviceChain()->proceed($joinPoint);
     if ($session->isStarted()) {
         $this->systemLogger->log(sprintf('%s: Changed session id from %s to %s', $this->getClassName($joinPoint), $oldId, $newId), LOG_INFO);
     }
     return $newId;
 }
 /**
  * Around advice, wrapping every method of a scope session object. It redirects
  * all method calls to the session object once there is one.
  *
  * @param JoinPointInterface $joinPoint The current join point
  * @return mixed
  * @Flow\Around("filter(Neos\Flow\Session\Aspect\SessionObjectMethodsPointcutFilter)")
  */
 public function callMethodOnOriginalSessionObject(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([$this->sessionOriginalInstances[$objectName], $methodName], $joinPoint->getMethodArguments());
     }
 }