N°8772 - test driven compiler wip

This commit is contained in:
Eric Espie
2025-12-05 16:53:02 +01:00
parent 8374d12869
commit 0d3f7c5f07
25 changed files with 334 additions and 24 deletions

View File

@@ -7,9 +7,39 @@
namespace Combodo\iTop\PropertyTree;
use Combodo\iTop\DesignElement;
use Combodo\iTop\PropertyTree\ValueType\ValueTypeFactory;
/**
* @since 3.3.0
*/
class Property extends AbstractProperty
{
/**
* @param \Combodo\iTop\DesignElement $oDomNode
*
* @return void
* @throws \Combodo\iTop\PropertyTree\PropertyTreeException
* @throws \DOMFormatException
*/
public function InitFromDomNode(DesignElement $oDomNode): void
{
parent::InitFromDomNode($oDomNode);
$oValueTypeNode = $oDomNode->GetOptionalElement('value-type');
if ($oValueTypeNode) {
$this->oValueType = ValueTypeFactory::GetInstance()->CreateValueTypeFromDomNode($oValueTypeNode);
}
}
public function ToPHP(&$aPHPFragments = []): string
{
$sFormBlockClass = $this->oValueType->GetFormBlockClass();
return <<<PHP
\$this->Add('$this->sId', '$sFormBlockClass', [
'label' => '$this->sLabel',
]);
PHP;
}
}