kernel/lib/Form/Container.php
public function handleRequest(array $aRequest) : bool
    {
        if (!count($_POST)) { return true; }

        // Validation
        foreach ($this->_oForm->getElement() as $sKey => $sValue) {

            if (!$sValue instanceof self && !$this->_validate($sValue)) {

                return false;
            }
        }
		
        // Save
        if ($this->_oForm->getIdEntity() > 0 && $this->_oForm->getSynchronizeEntity() !== null && count($aRequest) > 0) {

			$entityName = $this->_oForm->getSynchronizeEntity();
			$oEntity = new $entityName;
            $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);
            $sMethodName = 'set_'.$sPrimaryKey;

            call_user_func_array(array(&$oEntity, $sMethodName), array($this->_oForm->getIdEntity()));

            foreach ($this->_oForm->getElement() as $sKey => $sValue) {

                $sMethodName = 'set_'.$sValue->getName().'';
                if (method_exists($oEntity, $sMethodName)) {
					call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
				}
            }

            $oEntity->save();
        } else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) {

            $sClassName = $this->_oForm->getSynchronizeEntity();
            $oEntity = new $sClassName;

            foreach ($this->_oForm->getElement() as $sKey => $sValue) {

                if ($sValue->getName()) {
                    $sMethodName = 'set_' . $sValue->getName() . '';

                    if (method_exists($oEntity, $sMethodName)) {

                        $doc = Reader::getPhpDocOfMethod($sClassName, $sMethodName);

                        if ($doc['param'][0][0] === 'int') {
                            $aRequest[$sValue->getName()] = (int)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'string') {
                            $aRequest[$sValue->getName()] = (string)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'float') {
                            $aRequest[$sValue->getName()] = (float)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'bool') {
                            $aRequest[$sValue->getName()] = (bool)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'boolean') {
                            $aRequest[$sValue->getName()] = (bool)$aRequest[$sValue->getName()];
                        }

						call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
                    }
                }
            }

            $idRecord =  $oEntity->save();
            $this->setEntityObject($oEntity);
            $this->_oForm->setIdEntityCreated($idRecord);
        }

        $this->_bHandleRequestActivate = true;
        $this->_aRequest = $aRequest;
        return true;
    }
public function handleRequest(array $aRequest) : bool
    {
        if (!count($_POST)) { return true; }

        // Validation
        foreach ($this->_oForm->getElement() as $sKey => $sValue) {

            if (!$sValue instanceof self && !$this->_validate($sValue)) {

                return false;
            }
        }
		
        // Save
        if ($this->_oForm->getIdEntity() > 0 && $this->_oForm->getSynchronizeEntity() !== null && count($aRequest) > 0) {

			$entityName = $this->_oForm->getSynchronizeEntity();
			$oEntity = new $entityName;
            $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);
            $sMethodName = 'set_'.$sPrimaryKey;

            call_user_func_array(array(&$oEntity, $sMethodName), array($this->_oForm->getIdEntity()));

            foreach ($this->_oForm->getElement() as $sKey => $sValue) {

                $sMethodName = 'set_'.$sValue->getName().'';
                if (method_exists($oEntity, $sMethodName)) {
					call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
				}
            }

            $oEntity->save();
        } else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) {

            $sClassName = $this->_oForm->getSynchronizeEntity();
            $oEntity = new $sClassName;

            foreach ($this->_oForm->getElement() as $sKey => $sValue) {

                if ($sValue->getName()) {
                    $sMethodName = 'set_' . $sValue->getName() . '';

                    if (method_exists($oEntity, $sMethodName)) {

                        $doc = Reader::getPhpDocOfMethod($sClassName, $sMethodName);

                        if ($doc['param'][0][0] === 'int') {
                            $aRequest[$sValue->getName()] = (int)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'string') {
                            $aRequest[$sValue->getName()] = (string)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'float') {
                            $aRequest[$sValue->getName()] = (float)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'bool') {
                            $aRequest[$sValue->getName()] = (bool)$aRequest[$sValue->getName()];
                        }
                        if ($doc['param'][0][0] === 'boolean') {
                            $aRequest[$sValue->getName()] = (bool)$aRequest[$sValue->getName()];
                        }

						call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()]));
                    }
                }
            }

            $idRecord =  $oEntity->save();
            $this->setEntityObject($oEntity);
            $this->_oForm->setIdEntityCreated($idRecord);
        }

        $this->_bHandleRequestActivate = true;
        $this->_aRequest = $aRequest;
        return true;
    }
handle the request to do many actions on it

@access public
@param  array $aRequest request like $_POST
@return bool