className fix: If namespace is not set then ClassName will be cut of
This commit is contained in:
parent
c04b01cbd7
commit
a4c7a89507
@ -57,12 +57,10 @@ class <className> extends <repositoryName>
|
||||
*/
|
||||
public function generateEntityRepositoryClass($fullClassName)
|
||||
{
|
||||
$className = substr($fullClassName, strrpos($fullClassName, '\\') + 1, strlen($fullClassName));
|
||||
|
||||
$variables = array(
|
||||
'<namespace>' => $this->generateEntityRepositoryNamespace($fullClassName),
|
||||
'<repositoryName>' => $this->generateEntityRepositoryName($fullClassName),
|
||||
'<className>' => $className
|
||||
'<className>' => $this->generateClassName($fullClassName)
|
||||
);
|
||||
|
||||
return str_replace(array_keys($variables), array_values($variables), self::$_template);
|
||||
@ -82,6 +80,26 @@ class <className> extends <repositoryName>
|
||||
return $namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the class name
|
||||
*
|
||||
* @param string $fullClassName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateClassName($fullClassName)
|
||||
{
|
||||
$namespace = $this->getClassNamespace($fullClassName);
|
||||
|
||||
$className = $fullClassName;
|
||||
|
||||
if ($namespace) {
|
||||
$className = substr($fullClassName, strrpos($fullClassName, '\\') + 1, strlen($fullClassName));
|
||||
}
|
||||
|
||||
return $className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the namespace statement, if class do not have namespace, return empty string instead.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user