Gpf_Rpc_Form::__construct PHP Method

__construct() public method

public __construct ( Gpf_Rpc_Params $params = null )
$params Gpf_Rpc_Params
        public function __construct(Gpf_Rpc_Params $params = null)
        {
            $this->fields = new Gpf_Data_IndexedRecordSet(self::FIELD_NAME);
            $header = new Gpf_Data_RecordHeader();
            $header->add(self::FIELD_NAME);
            $header->add(self::FIELD_VALUE);
            $header->add(self::FIELD_VALUES);
            $header->add(self::FIELD_ERROR);
            $this->fields->setHeader($header);
            $this->validator = new Gpf_Rpc_Form_Validator_FormValidatorCollection($this);
            if ($params) {
                $this->loadFieldsFromArray($params->get("fields"));
            }
        }

Usage Example

    public function __construct(Gpf_Rpc_Params $params = null, $edit=true) {
		parent::__construct($params);
        $this->initCommissionGroupId($this->getFieldValue("CommissionGroupId"));
		if ($edit) {
            $this->commissionTypeId = $this->getFieldValue("Id");
            if($this->commissionTypeId == "") {
                throw new Exception($this->_("CommissionTypeId (Id) cannot be empty!"));
            }
		}
    }