aFieldsDescriptions; // merge each adapter data... foreach ($this->GetAllAdapters() as $oAdapter){ $aResult = array_merge($aResult, $oAdapter->GetFieldsDescriptions()); } return $aResult; } /** * Set form data. * * @param mixed $oData * * @return void */ public function SetData(mixed $oData) : void { $this->oFieldsData = $oData; } /*** * Get form data. * * @return array */ public function GetData() : mixed { $aData = $this->oFieldsData; foreach ($this->GetAllAdapters() as $adapter){ $aData = array_merge($aData, $adapter->GetFieldsData()); } return $aData; } /** * Set layout description. * * @param array $aLayoutDescription * * @return $this */ public function SetLayoutDescription(array $aLayoutDescription) : FormFactory { $this->aLayoutDescription = $aLayoutDescription; return $this; } /** * Return layout description. * * @return array */ public function GetLayoutDescription() : array { return $this->aLayoutDescription; } /** * Add an adapter. * * @param string $sKey * @param \Combodo\iTop\FormSDK\Service\FactoryAdapter\FormFactoryAdapterInterface $oAdapter * * @return $this */ public function AddAdapter(string $sKey, FormFactoryAdapterInterface $oAdapter) : FormFactory { $this->aAdapters[$sKey] = $oAdapter; return $this; } /** * Get all adapters. * * @return \Combodo\iTop\FormSDK\Service\FactoryAdapter\FormFactoryAdapterInterface[] */ public function GetAllAdapters() : array { return $this->aAdapters; } /** * Create an object adapter. * * @param \DBObject $oDBObject * @param bool $bGroup * * @return \Combodo\iTop\FormSDK\Service\FactoryAdapter\FormFactoryObjectAdapter */ public function CreateObjectAdapter(DBObject $oDBObject, bool $bGroup = true) : FormFactoryObjectAdapter { $oObjectBuilder = new FormFactoryObjectAdapter($oDBObject, $bGroup); $this->AddAdapter(get_class($oDBObject) . '_' . $oDBObject->GetKey(), $oObjectBuilder); return $oObjectBuilder; } /** * Create form. * * @param string|null $sName * @return mixed */ public function CreateForm(?string $sName = null) : mixed { return $this->oSymfonyBridge->CreateForm($this->GetFieldsDescriptions(), $this->GetData(), $sName, $this->GetLayoutDescription()); } }