mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°8772 - Form dependencies manager implementation
- Form SDK implementation - Basic Forms - Dynamics Forms - Basic Blocks + Data Model Block - Form Compilation - Turbo integration
This commit is contained in:
42
sources/Forms/IO/Format/ClassIOFormat.php
Normal file
42
sources/Forms/IO/Format/ClassIOFormat.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\Forms\IO\Format;
|
||||
|
||||
use Combodo\iTop\Service\DependencyInjection\DIService;
|
||||
use Combodo\iTop\Forms\IO\FormBlockIOException;
|
||||
|
||||
/**
|
||||
* Class IO format.
|
||||
*
|
||||
* @package Combodo\iTop\Forms\IO\Format
|
||||
* @since 3.3.0
|
||||
*/
|
||||
class ClassIOFormat extends AbstractIOFormat
|
||||
{
|
||||
public string $sClassName;
|
||||
|
||||
/**
|
||||
* @throws \Combodo\iTop\Service\DependencyInjection\DIException
|
||||
* @throws \Combodo\iTop\Forms\IO\FormBlockIOException
|
||||
*/
|
||||
public function __construct(string $sClassName)
|
||||
{
|
||||
// Check class validity
|
||||
/** @var \ModelReflection $oModelReflection */
|
||||
$oModelReflection = DIService::GetInstance()->GetService('ModelReflection');
|
||||
if (!$oModelReflection->IsValidClass($sClassName)) {
|
||||
throw new FormBlockIOException("Class ".json_encode($sClassName)." is not valid");
|
||||
}
|
||||
$this->sClassName = $sClassName;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->sClassName;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return $this->sClassName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user