mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 23:16:03 +00:00
console command changes
This commit is contained in:
@@ -40,7 +40,10 @@ class CommandManager
|
||||
|
||||
public function run(string $command)
|
||||
{
|
||||
$command = ucfirst(\Espo\Core\Utils\Util::hyphenToCamelCase($command));
|
||||
|
||||
$className = '\\Espo\\Core\\Console\\Commands\\' . $command;
|
||||
$className = $this->container->get('metadata')->get(['app', 'consoleCommands', $command, 'className'], $className);
|
||||
if (!class_exists($className)) {
|
||||
$msg = "Command '{$command}' does not exist.";
|
||||
echo $msg . "\n";
|
||||
|
||||
@@ -38,7 +38,7 @@ class Util
|
||||
*/
|
||||
protected static $separator = DIRECTORY_SEPARATOR;
|
||||
|
||||
protected static $reservedWords = array('Case');
|
||||
protected static $reservedWordList = ['Case'];
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,6 +51,16 @@ class Util
|
||||
return static::$separator;
|
||||
}
|
||||
|
||||
public static function camelCaseToUnderscore(string $string) : string
|
||||
{
|
||||
return static::toUnderScore($string);
|
||||
}
|
||||
|
||||
public static function hyphenToCamelCase(string $string) : string
|
||||
{
|
||||
return self::toCamelCase($string, '-');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert to format with defined delimeter
|
||||
@@ -136,11 +146,6 @@ class Util
|
||||
return static::fromCamelCase($name, '_');
|
||||
}
|
||||
|
||||
public static function camelCaseToUnderscore($value)
|
||||
{
|
||||
return static::toUnderScore($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge arrays recursively (default PHP function is not suitable)
|
||||
*
|
||||
@@ -299,7 +304,7 @@ class Util
|
||||
*/
|
||||
public static function normilizeClassName($name)
|
||||
{
|
||||
if (in_array($name, self::$reservedWords)) {
|
||||
if (in_array($name, self::$reservedWordList)) {
|
||||
$name .= 'Obj';
|
||||
}
|
||||
return $name;
|
||||
@@ -313,7 +318,7 @@ class Util
|
||||
*/
|
||||
public static function normilizeScopeName($name)
|
||||
{
|
||||
foreach (self::$reservedWords as $reservedWord) {
|
||||
foreach (self::$reservedWordList as $reservedWord) {
|
||||
if ($reservedWord.'Obj' == $name) {
|
||||
return $reservedWord;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user