1
0
mirror of synced 2025-01-09 18:47:10 +03:00

className fix: If namespace is not set then ClassName will be cut of

This commit is contained in:
encoder64 2014-07-27 17:28:06 +03:00
parent c04b01cbd7
commit a4c7a89507

View File

@ -57,12 +57,10 @@ class <className> extends <repositoryName>
*/ */
public function generateEntityRepositoryClass($fullClassName) public function generateEntityRepositoryClass($fullClassName)
{ {
$className = substr($fullClassName, strrpos($fullClassName, '\\') + 1, strlen($fullClassName));
$variables = array( $variables = array(
'<namespace>' => $this->generateEntityRepositoryNamespace($fullClassName), '<namespace>' => $this->generateEntityRepositoryNamespace($fullClassName),
'<repositoryName>' => $this->generateEntityRepositoryName($fullClassName), '<repositoryName>' => $this->generateEntityRepositoryName($fullClassName),
'<className>' => $className '<className>' => $this->generateClassName($fullClassName)
); );
return str_replace(array_keys($variables), array_values($variables), self::$_template); return str_replace(array_keys($variables), array_values($variables), self::$_template);
@ -82,6 +80,26 @@ class <className> extends <repositoryName>
return $namespace; 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. * Generates the namespace statement, if class do not have namespace, return empty string instead.
* *