mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 07:33:50 +00:00
add form to doc generation and custom form to admin template configuration
This commit is contained in:
@@ -40,6 +40,17 @@ class ContextManager
|
||||
throw new ContextNotFoundException($docGeneratorTemplate->getContext());
|
||||
}
|
||||
|
||||
public function getContextByKey(string $searchedKey): DocGeneratorContextInterface
|
||||
{
|
||||
foreach ($this->contexts as $key => $context) {
|
||||
if ($searchedKey === $key) {
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ContextNotFoundException($searchedKey);
|
||||
}
|
||||
|
||||
public function getContexts(): array
|
||||
{
|
||||
return iterator_to_array($this->contexts);
|
||||
|
@@ -13,9 +13,10 @@ namespace Chill\DocGeneratorBundle\Context;
|
||||
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* Interface for context for for document generation.
|
||||
* Interface for context for document generation.
|
||||
*/
|
||||
interface DocGeneratorContextInterface
|
||||
{
|
||||
@@ -24,28 +25,37 @@ interface DocGeneratorContextInterface
|
||||
*
|
||||
* @param mixed $entity
|
||||
*/
|
||||
public function getData($entity): array;
|
||||
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array;
|
||||
|
||||
/**
|
||||
* Generate the form that display.
|
||||
*
|
||||
* @param mixed $entity
|
||||
*/
|
||||
public function getForm($entity);
|
||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void;
|
||||
|
||||
public static function getKey(): string;
|
||||
|
||||
public function getName(): string;
|
||||
|
||||
public function getDescription(): string;
|
||||
|
||||
/**
|
||||
* has form.
|
||||
*
|
||||
* @param mixed $entity
|
||||
*/
|
||||
public function hasForm(): bool;
|
||||
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool;
|
||||
|
||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity): void;
|
||||
public function hasAdminForm(): bool;
|
||||
|
||||
/**
|
||||
* True of false which entity supports.
|
||||
*/
|
||||
public function supports(string $entityClass): bool;
|
||||
public function buildAdminForm(FormBuilderInterface $builder): void;
|
||||
|
||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void;
|
||||
|
||||
public function getEntityClass(): string;
|
||||
|
||||
public function adminFormTransform(array $data): array;
|
||||
|
||||
public function adminFormReverseTransform(array $data): array;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ use function get_class;
|
||||
/**
|
||||
* Context that display a form to select a member of a houseHold.
|
||||
*/
|
||||
class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
||||
class HouseholdMemberSelectionContext //implements DocGeneratorContextInterface
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
|
Reference in New Issue
Block a user