Returns the name of the lifecycle shutdown method for this object
public getLifecycleShutdownMethodName ( ) : string | ||
return | string | The name of the shutdown method |
/** * Builds code which registers the lifecycle shutdown method, if any. * * @param Configuration $objectConfiguration * @return string */ protected function buildLifecycleShutdownCode(Configuration $objectConfiguration) { $lifecycleShutdownMethodName = $objectConfiguration->getLifecycleShutdownMethodName(); if (!$this->reflectionService->hasMethod($objectConfiguration->getClassName(), $lifecycleShutdownMethodName)) { return ''; } $className = $objectConfiguration->getClassName(); $code = "\n" . ' if (get_class($this) === \'' . $className . '\') {' . "\n"; $code .= ' \\Neos\\Flow\\Core\\Bootstrap::$staticObjectManager->registerShutdownObject($this, \'' . $lifecycleShutdownMethodName . '\');' . PHP_EOL; $code .= ' }' . "\n"; return $code; }
/** * Builds code which registers the lifecycle shutdown method, if any. * * @param Configuration $objectConfiguration * @param int $cause a ObjectManagerInterface::INITIALIZATIONCAUSE_* constant which is the cause of the initialization command being called. * @return string */ protected function buildLifecycleShutdownCode(Configuration $objectConfiguration, $cause) { $lifecycleShutdownMethodName = $objectConfiguration->getLifecycleShutdownMethodName(); if (!$this->reflectionService->hasMethod($objectConfiguration->getClassName(), $lifecycleShutdownMethodName)) { return ''; } $className = $objectConfiguration->getClassName(); $code = "\n" . ' $isSameClass = get_class($this) === \'' . $className . '\';'; if ($cause === ObjectManagerInterface::INITIALIZATIONCAUSE_RECREATED) { $code .= "\n" . ' $classParents = class_parents($this);'; $code .= "\n" . ' $classImplements = class_implements($this);'; $code .= "\n" . ' $isClassProxy = array_search(\'' . $className . '\', $classParents) !== FALSE && array_search(\'Doctrine\\ORM\\Proxy\\Proxy\', $classImplements) !== FALSE;' . "\n"; $code .= "\n" . ' if ($isSameClass || $isClassProxy) {' . "\n"; } else { $code .= "\n" . ' if ($isSameClass) {' . "\n"; } $code .= ' \\Neos\\Flow\\Core\\Bootstrap::$staticObjectManager->registerShutdownObject($this, \'' . $lifecycleShutdownMethodName . '\');' . PHP_EOL; $code .= ' }' . "\n"; return $code; }