mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°8772 - automatic dependency in controller WIP
This commit is contained in:
@@ -134,8 +134,7 @@ abstract class AbstractFormBlock
|
||||
*/
|
||||
public function AddInput(string $sName, string $sType): void
|
||||
{
|
||||
$oFormInput = new FormInput($sName, $sType);
|
||||
$oFormInput->SetOwnerBlock($this);
|
||||
$oFormInput = new FormInput($sName, $sType, $this);
|
||||
$this->aFormInputs[$oFormInput->GetName()] = $oFormInput;
|
||||
}
|
||||
|
||||
@@ -167,8 +166,7 @@ abstract class AbstractFormBlock
|
||||
*/
|
||||
public function AddOutput(string $sName, string $sType, AbstractConverter $oConverter = null): void
|
||||
{
|
||||
$oFormOutput = new FormOutput($sName, $sType, $oConverter);
|
||||
$oFormOutput->SetOwnerBlock($this);
|
||||
$oFormOutput = new FormOutput($sName, $sType, $this, $oConverter);
|
||||
$this->aFormOutputs[$oFormOutput->GetName()] = $oFormOutput;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,11 @@ class AbstractFormIO
|
||||
* @param string $sName name of the IO
|
||||
* @param string $sType type of the IO
|
||||
*/
|
||||
public function __construct(string $sName, string $sType)
|
||||
public function __construct(string $sName, string $sType, AbstractFormBlock $oOwnerBlock)
|
||||
{
|
||||
$this->sName = $sName;
|
||||
$this->sType = $sType;
|
||||
$this->oOwnerBlock = $oOwnerBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,20 +55,6 @@ class AbstractFormIO
|
||||
return $this->oOwnerBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the owner block.
|
||||
*
|
||||
* @param AbstractFormBlock $oOwnerBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetOwnerBlock(AbstractFormBlock $oOwnerBlock): self
|
||||
{
|
||||
$this->oOwnerBlock = $oOwnerBlock;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IO name.
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace Combodo\iTop\Forms\Block\IO;
|
||||
|
||||
use Combodo\iTop\Forms\Block\AbstractFormBlock;
|
||||
use Combodo\iTop\Forms\Block\IO\Converter\AbstractConverter;
|
||||
|
||||
/**
|
||||
@@ -27,9 +28,9 @@ class FormOutput extends AbstractFormIO
|
||||
* @param string $sType
|
||||
* @param AbstractConverter|null $oConverter
|
||||
*/
|
||||
public function __construct(string $sName, string $sType, AbstractConverter $oConverter = null)
|
||||
public function __construct(string $sName, string $sType, AbstractFormBlock $oOwnerBlock, AbstractConverter $oConverter = null)
|
||||
{
|
||||
parent::__construct($sName, $sType);
|
||||
parent::__construct($sName, $sType, $oOwnerBlock);
|
||||
$this->oConverter = $oConverter;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,19 @@ class DependencyMap
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
public function GetImpacted(string $sBlockName): array
|
||||
{
|
||||
$aImpacted = [];
|
||||
foreach ($this->aOutputToInputsMap[$sBlockName] as $aBindings) {
|
||||
foreach ($aBindings as $oBinding) {
|
||||
$oDestBlock = $oBinding->oDestinationIO->GetOwnerBlock();
|
||||
$aImpacted[] = $oDestBlock;
|
||||
}
|
||||
}
|
||||
|
||||
return $aImpacted;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBlockName
|
||||
*
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2025 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\sources\Forms\Block\IO;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
|
||||
class AbstractFormIOTest extends ItopDataTestCase
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user