本文整理汇总了PHP中Espo\Core\Utils\Util::normilizeClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::normilizeClassName方法的具体用法?PHP Util::normilizeClassName怎么用?PHP Util::normilizeClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Espo\Core\Utils\Util
的用法示例。
在下文中一共展示了Util::normilizeClassName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImplementation
public function getImplementation($scope)
{
if (empty($this->implementationHashMap[$scope])) {
$normalizedName = Util::normilizeClassName($scope);
$className = '\\Espo\\Custom\\AclPortal\\' . $normalizedName;
if (!class_exists($className)) {
$moduleName = $this->getMetadata()->getScopeModuleName($scope);
if ($moduleName) {
$className = '\\Espo\\Modules\\' . $moduleName . '\\AclPortal\\' . $normalizedName;
} else {
$className = '\\Espo\\AclPortal\\' . $normalizedName;
}
if (!class_exists($className)) {
$className = '\\Espo\\Core\\AclPortal\\Base';
}
}
if (class_exists($className)) {
$acl = new $className($scope);
$dependencies = $acl->getDependencyList();
foreach ($dependencies as $name) {
$acl->inject($name, $this->getContainer()->get($name));
}
$this->implementationHashMap[$scope] = $acl;
} else {
throw new Error();
}
}
return $this->implementationHashMap[$scope];
}
示例2: getNotificator
protected function getNotificator($entityType)
{
if (empty($this->notifatorsHash[$entityType])) {
$normalizedName = Util::normilizeClassName($entityType);
$className = '\\Espo\\Custom\\Notificators\\' . $normalizedName;
if (!class_exists($className)) {
$moduleName = $this->getMetadata()->getScopeModuleName($entityType);
if ($moduleName) {
$className = '\\Espo\\Modules\\' . $moduleName . '\\Notificators\\' . $normalizedName;
} else {
$className = '\\Espo\\Notificators\\' . $normalizedName;
}
if (!class_exists($className)) {
$className = '\\Espo\\Core\\Notificators\\Base';
}
}
$notificator = new $className();
$dependencies = $notificator->getDependencyList();
foreach ($dependencies as $name) {
$notificator->inject($name, $this->getContainer()->get($name));
}
$this->notifatorsHash[$entityType] = $notificator;
}
return $this->notifatorsHash[$entityType];
}
示例3: normalizeEntityName
public function normalizeEntityName($name)
{
if (empty($this->entityClassNameHash[$name])) {
$className = '\\Espo\\Custom\\Entities\\' . Util::normilizeClassName($name);
if (!class_exists($className)) {
$className = $this->espoMetadata->getEntityPath($name);
}
$this->entityClassNameHash[$name] = $className;
}
return $this->entityClassNameHash[$name];
}
示例4: getClassName
protected function getClassName($name)
{
$name = Util::normilizeClassName($name);
if (!isset($this->data)) {
$this->init();
}
$name = ucfirst($name);
if (isset($this->data[$name])) {
return $this->data[$name];
}
return false;
}
示例5: process
public function process($controllerName, $actionName, $params, $data, $request)
{
$customeClassName = '\\Espo\\Custom\\Controllers\\' . Util::normilizeClassName($controllerName);
if (class_exists($customeClassName)) {
$controllerClassName = $customeClassName;
} else {
$moduleName = $this->metadata->getScopeModuleName($controllerName);
if ($moduleName) {
$controllerClassName = '\\Espo\\Modules\\' . $moduleName . '\\Controllers\\' . Util::normilizeClassName($controllerName);
} else {
$controllerClassName = '\\Espo\\Controllers\\' . Util::normilizeClassName($controllerName);
}
}
if ($data && stristr($request->getContentType(), 'application/json')) {
$data = json_decode($data);
}
if ($data instanceof \stdClass) {
$data = get_object_vars($data);
}
if (!class_exists($controllerClassName)) {
throw new NotFound("Controller '{$controllerName}' is not found");
}
$controller = new $controllerClassName($this->container, $request->getMethod());
if ($actionName == 'index') {
$actionName = $controllerClassName::$defaultAction;
}
$actionNameUcfirst = ucfirst($actionName);
$beforeMethodName = 'before' . $actionNameUcfirst;
$actionMethodName = 'action' . $actionNameUcfirst;
$afterMethodName = 'after' . $actionNameUcfirst;
$fullActionMethodName = strtolower($request->getMethod()) . ucfirst($actionMethodName);
if (method_exists($controller, $fullActionMethodName)) {
$primaryActionMethodName = $fullActionMethodName;
} else {
$primaryActionMethodName = $actionMethodName;
}
if (!method_exists($controller, $primaryActionMethodName)) {
throw new NotFound("Action '{$actionName}' (" . $request->getMethod() . ") does not exist in controller '{$controllerName}'");
}
if (method_exists($controller, $beforeMethodName)) {
$controller->{$beforeMethodName}($params, $data, $request);
}
$result = $controller->{$primaryActionMethodName}($params, $data, $request);
if (method_exists($controller, $afterMethodName)) {
$controller->{$afterMethodName}($params, $data, $request);
}
if (is_array($result) || is_bool($result) || $result instanceof \StdClass) {
return \Espo\Core\Utils\Json::encode($result);
}
return $result;
}
示例6: create
public function create($entityName)
{
$className = '\\Espo\\Custom\\SelectManagers\\' . Util::normilizeClassName($entityName);
if (!class_exists($className)) {
$moduleName = $this->metadata->getScopeModuleName($entityName);
if ($moduleName) {
$className = '\\Espo\\Modules\\' . $moduleName . '\\SelectManagers\\' . Util::normilizeClassName($entityName);
} else {
$className = '\\Espo\\SelectManagers\\' . Util::normilizeClassName($entityName);
}
if (!class_exists($className)) {
$className = '\\Espo\\Core\\SelectManagers\\Base';
}
}
$selectManager = new $className($this->entityManager, $this->user, $this->acl, $this->metadata);
$selectManager->setEntityName($entityName);
return $selectManager;
}
示例7: getRepositoryPath
public function getRepositoryPath($entityName, $delim = '\\')
{
$path = $this->getScopePath($entityName, $delim);
return implode($delim, array($path, 'Repositories', Util::normilizeClassName(ucfirst($entityName))));
}
示例8: delete
public function delete($name)
{
if (!$this->isCustom($name)) {
throw new Forbidden();
}
$normalizedName = Util::normilizeClassName($name);
$unsets = array('entityDefs', 'clientDefs', 'scopes');
$res = $this->getMetadata()->delete('entityDefs', $name);
$res = $this->getMetadata()->delete('clientDefs', $name);
$res = $this->getMetadata()->delete('scopes', $name);
$this->getFileManager()->removeFile("custom/Espo/Custom/Resources/metadata/entityDefs/{$name}.json");
$this->getFileManager()->removeFile("custom/Espo/Custom/Resources/metadata/clientDefs/{$name}.json");
$this->getFileManager()->removeFile("custom/Espo/Custom/Resources/metadata/scopes/{$name}.json");
$this->getFileManager()->removeFile("custom/Espo/Custom/Entities/{$normalizedName}.php");
$this->getFileManager()->removeFile("custom/Espo/Custom/Services/{$normalizedName}.php");
$this->getFileManager()->removeFile("custom/Espo/Custom/Controllers/{$normalizedName}.php");
$this->getFileManager()->removeFile("custom/Espo/Custom/Repositories/{$normalizedName}.php");
try {
$this->getLanguage()->delete('Global', 'scopeNames', $name);
$this->getLanguage()->delete('Global', 'scopeNamesPlural', $name);
} catch (\Exception $e) {
}
$this->getMetadata()->save();
$this->getLanguage()->save();
return true;
}
示例9: getClassName
/**
* Get class name of a job
*
* @param string $name
* @return string
*/
protected function getClassName($name)
{
$name = Util::normilizeClassName($name);
$data = $this->getAll();
$name = ucfirst($name);
if (isset($data[$name])) {
return $data[$name];
}
return false;
}