Returns the key of the package the specified object is contained in.
public getPackageKeyByObjectName ( string $objectName ) : string | ||
$objectName | string | The object name |
return | string | The package key or FALSE if no such object exists |
/** * Explicitly sets the object name of the controller * * @param string $unknownCasedControllerObjectName The fully qualified controller object name * @return void * @throws UnknownObjectException * @api */ public function setControllerObjectName($unknownCasedControllerObjectName) { $controllerObjectName = $this->objectManager->getCaseSensitiveObjectName($unknownCasedControllerObjectName); if ($controllerObjectName === false) { throw new UnknownObjectException('The object "' . $unknownCasedControllerObjectName . '" is not registered.', 1268844071); } $this->controllerPackageKey = $this->objectManager->getPackageKeyByObjectName($controllerObjectName); $matches = []; $subject = substr($controllerObjectName, strlen($this->controllerPackageKey) + 1); preg_match('/ ^( Controller | (?P<subpackageKey>.+)\\\\Controller ) \\\\(?P<controllerName>[a-z\\\\]+)Controller $/ix', $subject, $matches); $this->controllerSubpackageKey = isset($matches['subpackageKey']) ? $matches['subpackageKey'] : null; $this->controllerName = $matches['controllerName']; }