mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-27 14:14:11 +01:00
poc form SDK (change dependencies implementation)
This commit is contained in:
33
sources/DI/Form/Manager/ObjectFormManager.php
Normal file
33
sources/DI/Form/Manager/ObjectFormManager.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\DI\Form\Manager;
|
||||
|
||||
use DBObject;
|
||||
use Exception;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ObjectFormManager
|
||||
{
|
||||
/**
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param \DBObject $oDbObject
|
||||
* @param string $sFormName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function applyRequestLockedAttributesToObject(Request $request, DBObject $oDbObject, string $sFormName){
|
||||
|
||||
try{
|
||||
$aValue = $request->get($sFormName);
|
||||
$sLockedAttributes = $aValue['locked_attributes'];
|
||||
$aLockedAttributes = json_decode($sLockedAttributes);
|
||||
foreach($aLockedAttributes as $sKey => $sValue){
|
||||
$oDbObject->Set($sKey, $sValue);
|
||||
}
|
||||
}
|
||||
catch(Exception $e){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user