N°7063 - Forms SDK - Add Symfony forms component

error forms issue
This commit is contained in:
Benjamin Dalsass
2024-01-02 11:31:52 +01:00
parent 2bcc4d9989
commit 75fde4c9a3
15 changed files with 316 additions and 73 deletions

View File

@@ -140,7 +140,7 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
}
/** @inheritdoc */
public function GetFormData() : array
public function GetFieldsData() : array
{
$aData = [];
foreach ($this->aAttributes as $sAttributeCode => $oValue){
@@ -164,13 +164,13 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
}
/** @inheritdoc */
public function GetFormDescriptions() : array
public function GetFieldsDescriptions() : array
{
$aDescriptions = [];
$aFieldsDescriptions = [];
foreach ($this->aAttributes as $sAttCode => $oValue){
try {
$aDescriptions[$this->GetAttributeName($sAttCode)] = $this->GetAttributeDescription($sAttCode);
$aFieldsDescriptions[$this->GetAttributeName($sAttCode)] = $this->GetAttributeDescription($sAttCode);
}
catch (Exception $e) {
ExceptionLog::LogException($e);
@@ -179,13 +179,13 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
if($this->bGroup){
$oGroupDescriptions = new FormFieldDescription($this->GetIdentifier(), FormFieldTypeEnumeration::DB_OBJECT, [
'descriptions' => $aDescriptions,
'fields' => $aFieldsDescriptions,
'label' => $this->GetLabel()
]);
return [$this->GetIdentifier() => $oGroupDescriptions];
}
else{
return $aDescriptions;
return $aFieldsDescriptions;
}
}
@@ -199,4 +199,20 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
{
return get_class($this->oDBObject) . '_' . $this->oDBObject->GetKey();
}
/** @inheritdoc */
public function UpdateFieldsData(array $aFormData) : bool
{
if($this->bGroup){
$aFormData = $aFormData[$this->GetIdentifier()];
}
foreach ($this->aAttributes as $sAttCode => $aValue){
$this->oDBObject->Set($sAttCode, $aFormData[$this->GetAttributeName($sAttCode)]);
}
$this->oDBObject->DBUpdate();
return true;
}
}