Skip to main content

Upgrading to Jadu XFP 7.0.0

Breaking Changes

Custom Components

  1. Icon will no not show unless the service definition is updated to remove the icon- prefix from the icon: setting in the YAML.

Example:

Before:
xfp_sfc.text_area:
class: Jadu\XFormsPro\Bundle\StandardFormComponentBundle\Component\TextArea\TextAreaComponent
arguments:
- "@xfp_sfc.text_area_service"
- "@xfp_sfc.text_area_settings_service"
tags:
- { name: xfp.form_component, label: 'Text Area', icon: 'icon-paragraph' }
- { name: xfp.form_component, alias: '39c1d58d95f4fbb636ae61c4dccd9992ce707c24' }

After:
xfp_sfc.text_area:
class: Jadu\XFormsPro\Bundle\StandardFormComponentBundle\Component\TextArea\TextAreaComponent
arguments:
- "@xfp_sfc.text_area_service"
- "@xfp_sfc.text_area_settings_service"
tags:
- { name: xfp.form_component, label: 'Text Area', icon: 'paragraph' }
- { name: xfp.form_component, alias: '39c1d58d95f4fbb636ae61c4dccd9992ce707c24' }

  1. Custom components can no longer use UserAnswer::setAnswerLabel() when saving answers, instead they should use the object Jadu\XFormsPro\Form\Builder\UserAnswerMetadata.

Example:

Before:
$answer->setAnswerLabel($appointment['text']);
After:
$answerMetadata = new UserAnswerMetadata();
$answerMetadata->setField('label');
$answerMetadata->setValue($appointment['text']);
$answer->addMetadata($answerMetadata);

Ensuring the setField argument is ‘label’, all lowercase. The argument used in the setAnswerLabel must be used in the setValue method on the UserAnswerMetadata object.

Custom Clauses

Custom clauses are no longer extensible and your custom clauses will not be loaded into the application. No alternatives exist for this functionality.

Custom Actions

Progress style custom actions that extend from Jadu\XFormsPro\Form\Rules\Actions\ProgressMappedActionType could implement their own populateData method. Custom actions should either remove their own implementation of this method or reimplement it to ensure that a call is made to the parent method where additional data needs to be appended.

An example Progress Mapped Action Type

Example:

Before:
public function populateData($request, $step)
{
$productID = $request->request->getInt('productID', -1);

$output = [
'productID' => $productID,
];

/** @var Jadu_PayBridge_Product $product */
$product = $this->productMapper->getByID($productID);

if ($product && $product->id > 0) {
/** @var Jadu_PayBridge_ProductSchemaElement[] $schemaElements */
$schemaElements = $this->schemaElementMapper->getByPSPID($product->pspID);

foreach ($schemaElements as $element) {
$mapping = $this->getBySchemaElementAndProduct($element->id, $product->id);
if (!is_null($mapping) && $mapping->mappingValue != '') {
$output[$element->mappingName] = $mapping->mappingValue;
}
}
}

return $output;
}
After:
public function populateData($request, $step)
{
$output = parent::populateData($request, $step);

$productID = $request->request->getInt('productID', -1);
$output['productID'] = $productID;

$product = $this->productMapper->getByID($productID);

if ($product && $product->id > 0) {
$schemaElements = $this->schemaElementMapper->getByPSPID($product->pspID);

foreach ($schemaElements as $element) {
$mapping = $this->getBySchemaElementAndProduct($element->id, $product->id);
if ($mapping !== null && $mapping->mappingValue !== '') {
$output[$element->mappingName] = $mapping->mappingValue;
}
}
}

return $output;

}

Guzzle V3 removed

The symfony services xfp_core.guzzle.client and xfp_core.guzzle.client_factory have been removed. Any custom code relying on these services will need to be updated to use Guzzle6.

Documentation for Guzzle 6 can be found here: http://docs.guzzlephp.org/en/stable/

ReceivedFormService Changes

The method getFormDetails previously returned an array with keys id, title and isLegacy.

This method now returns a Jadu_XForms2_Form object.

Example:

Before:
$form = $recievedFormService->getFormDetails($unsubmittedForm->getFormId());
if ($form[‘id’] === -1) {
...
}
After:
$form = $recievedFormService->getFormDetails($unsubmittedForm->getFormId());
if ($form->id === -1) {
...
}

JaduXFormsFormValidation Changes

Database column standard has been renamed to type. Possible values are now predefinedvalidationroutine and regexvalidationroutine.

SQL files that insert into JaduXFormsFormValidation for custom validation routines that call PHP functions need to be updated to reflect the above. For validation routines thats call a PHP function should use the type predefinedvalidationroutine.

Validation routines created via the control centre do not need to be updated. They will be updated via a migration as part of the patch.