N°8771 - Add Symfony form component to iTop core

- IO
This commit is contained in:
Benjamin Dalsass
2025-10-24 07:54:51 +02:00
parent a51272f107
commit 7708f8e00e
11 changed files with 133 additions and 22 deletions

View File

@@ -6,6 +6,9 @@
namespace Combodo\iTop\Forms\Block\IO;
use Combodo\iTop\Forms\Block\FormBlock;
use Combodo\iTop\Forms\Block\FormBlockIOException;
class FormInput
{
private string $sName;
@@ -17,7 +20,7 @@ class FormInput
public function __construct(string $sName, string $sType)
{
$this->sName = $sName;
$this->sType = $sName;
$this->sType = $sType;
}
public function GetName(): string
@@ -40,9 +43,14 @@ class FormInput
$this->sType = $sType;
}
public function Connect(string $sOutputBlockName, string $sOutputName): void
public function Connect(FormBlock $sOutputBlock, string $sOutputName): void
{
$this->aConnections[] = ['output_block' => $sOutputBlockName, 'output' => $sOutputName];
$sOutputType = $sOutputBlock->GetOutput($sOutputName)->GetType();
if($this->sType !== $sOutputType){
throw new FormBlockIOException('Cannot connect input types incompatibles ' . $this->sName . ' to ' . $sOutputBlock->GetName() . ' ' . $sOutputName);
}
$this->aConnections[] = ['output_block' => $sOutputBlock, 'output' => $sOutputName];
}
public function GetConnections(): array