mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented type for FormClassNameService and solved reference bugs
This commit is contained in:
@@ -7,10 +7,19 @@ namespace App\Domain\FormManagement;
|
||||
*/
|
||||
final class FormClassNameService implements FormClassNameServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var string Folder in which the entities are stored
|
||||
*/
|
||||
const ENTITY_BASE_PATH = 'App\\Entity';
|
||||
|
||||
/**
|
||||
* @var string Folder in which the forms are stored
|
||||
*/
|
||||
const FORM_BASE_PATH = 'App\\Form';
|
||||
|
||||
/**
|
||||
* @var string Suffix to identifie form classes
|
||||
*/
|
||||
const SUFFIX = 'Type';
|
||||
|
||||
/**
|
||||
@@ -18,10 +27,11 @@ final class FormClassNameService implements FormClassNameServiceInterface
|
||||
*
|
||||
* @see \App\Domain\FormManagement\FormClassNameServiceInterface::getClass()
|
||||
*/
|
||||
public function getClass(string $origineClass): string
|
||||
public function getClass(string $origineClass, string $type = ''): string
|
||||
{
|
||||
$replaced = str_replace(self::ENTITY_BASE_PATH, self::FORM_BASE_PATH, $origineClass);
|
||||
$withSuffix = $replaced.self::SUFFIX;
|
||||
$withType = $replaced.ucfirst($type);
|
||||
$withSuffix = $withType.self::SUFFIX;
|
||||
|
||||
return $withSuffix;
|
||||
}
|
||||
|
@@ -14,5 +14,5 @@ interface FormClassNameServiceInterface
|
||||
*
|
||||
* @return string The name of the form of the entity
|
||||
*/
|
||||
public function getClass(string $origineClass): string;
|
||||
public function getClass(string $origineClass, string $type = ''): string;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class RequestedEntityFormBuilderService implements EntityFormBuilderServiceInterface
|
||||
final class RequestedEntityFormBuilderService implements RequestedEntityFormBuilderServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var FormBuilderInterface
|
||||
|
Reference in New Issue
Block a user