[BUG]: JCB Packager: Subform Field Dependencies Not Included in JCB Package Build #1239

Open
opened 2025-07-24 21:01:41 +00:00 by Lemuel · 1 comment
Member

What Happened?

I have created a subform field within JCB. This subform field is linked to a component which I intend to distribute via a JCB package. The subform field contains two fields that are only used within the subform—they are not used anywhere else in the component.

These two dependent fields are explicitly defined within the subform and correctly referenced in the subform’s configuration. I’ve verified this through the code snippet showing the field dependencies, which clearly lists the two fields as dependencies of the subform.

{
    "name": "Ingredients (Subform)",
    "fieldtype": "7139f2c8-a70a-46a6-bbe3-4eefe54ca515",
    "datatype": "TEXT",
    "indexes": "0",
    "null_switch": "NOT NULL",
    "store": 0,
    "on_get_model_field": "",
    "on_save_model_field": "",
    "initiator_on_get_model": "",
    "xml": "<field\n\ttype=\"subform\"\n\tname=\"ingredients\"\n\tlabel=\"The Ingredients List\"\n\tlayout=\"joomla.form.field.subform.repeatable-table\"\n\tcomponent=\"\"\n\tclient=\"\"\n\tmultiple=\"true\"\n\tbuttons=\"add,remove,move\"\n\tfields=\"69ffb53e-521a-48c9-a158-2c0e82837cf1,e05f7665-ce58-448b-bfee-17a957723961\"\n\tformsource=\"\"\n\tdescription=\"\"\n\tdefault=\"\"\n\ticon=\"list\"\n\tmax=\"50\"\n\tmin=\"1\"\n\tfilter=\"\"\n\tshowon=\"\"\n\/>",
    "datalenght": "",
    "javascript_view_footer": "",
    "css_views": "",
    "css_view": "",
    "datadefault_other": "",
    "datadefault": "",
    "datalenght_other": "",
    "javascript_views_footer": "",
    "add_css_view": 0,
    "add_css_views": 0,
    "add_javascript_view_footer": 0,
    "add_javascript_views_footer": 0,
    "initiator_on_save_model": "",
    "guid": "fb14a5b4-e9a4-45c3-aa4d-bc7639e7760f",
    "@dependencies": [
        {
            "key": "guid",
            "value": "7139f2c8-a70a-46a6-bbe3-4eefe54ca515",     ---->     This is the Subform Fieldtype
            "entity": "fieldtype",
            "table": "#__componentbuilder_fieldtype",
            "direction": "out"
        },
        {
            "key": "field",
            "value": "69ffb53e-521a-48c9-a158-2c0e82837cf1",     ---->     This is the linked Field that is missing
            "entity": "guid",
            "table": "#__componentbuilder_field",
            "direction": "out"
        },
        {
            "key": "field",
            "value": "e05f7665-ce58-448b-bfee-17a957723961",    ---->     This is the linked Field that is missing
            "entity": "guid",
            "table": "#__componentbuilder_field",
            "direction": "out"
        }
    ]
}

Here is a screenshot of the fields in the package repository and as can be clearly seen, there is only the subform and not the other two linked fields:
image.png

Steps to reproduce the Bug

Create a Subform field with linked Fields that are not linked to any other area than the subform and push that Subform to a package repository.

Which Joomla version are you compiling in?

v5.3.2

Which PHP version are you compiling in?

v8.3

Which Joomla versions are you targeting?

v5.1.2-alpha1

Which PHP version are you targeting?

v8.3

Which Web server is JCB running on?

Latest

Which Relational Database is JCB running on?

11.4.3-MariaDB-ubu2404

Which OS is JCB running on?

Ubuntu 24.04 LTS

Which JCB version are you using?

v5.1.2-alpha1

Where in JCB did this issue occur?

Other

On which browsers did you encounter the issue?

Firefox

Additional Comments

When I var_dump the $dependencies in the item function I get the following:

array(2) {
  ["fieldtype"]=>
  array(1) {
    ["guid|7139f2c8-a70a-46a6-bbe3-4eefe54ca515"]=>
    array(5) {
      ["key"]=>
      string(4) "guid"
      ["value"]=>
      string(36) "7139f2c8-a70a-46a6-bbe3-4eefe54ca515"
      ["entity"]=>
      string(9) "fieldtype"
      ["table"]=>
      string(29) "#__componentbuilder_fieldtype"
      ["direction"]=>
      string(3) "out"
    }
  }
  ["guid"]=>
  array(2) {
    ["field|69ffb53e-521a-48c9-a158-2c0e82837cf1"]=>
    array(5) {
      ["key"]=>
      string(5) "field"
      ["value"]=>
      string(36) "69ffb53e-521a-48c9-a158-2c0e82837cf1"
      ["entity"]=>
      string(4) "guid"
      ["table"]=>
      string(25) "#__componentbuilder_field"
      ["direction"]=>
      string(3) "out"
    }
    ["field|e05f7665-ce58-448b-bfee-17a957723961"]=>
    array(5) {
      ["key"]=>
      string(5) "field"
      ["value"]=>
      string(36) "e05f7665-ce58-448b-bfee-17a957723961"
      ["entity"]=>
      string(4) "guid"
      ["table"]=>
      string(25) "#__componentbuilder_field"
      ["direction"]=>
      string(3) "out"
    }
  }
}

Dependencies are found...

Also in the Remote/Set.php class, when I push the subform field and it already exists in the repo, but its dependencies does not, it triggers the updateItem and returns NO CHANGE: Field item [Ingredients (Subform)] in repo (https://github.com/repo/JCB_package) is already in sync.

### What Happened? I have created a subform field within JCB. This subform field is linked to a component which I intend to distribute via a JCB package. The subform field contains two fields that are only used within the subform—they are not used anywhere else in the component. These two dependent fields are explicitly defined within the subform and correctly referenced in the subform’s configuration. I’ve verified this through the code snippet showing the field dependencies, which clearly lists the two fields as dependencies of the subform. ``` { "name": "Ingredients (Subform)", "fieldtype": "7139f2c8-a70a-46a6-bbe3-4eefe54ca515", "datatype": "TEXT", "indexes": "0", "null_switch": "NOT NULL", "store": 0, "on_get_model_field": "", "on_save_model_field": "", "initiator_on_get_model": "", "xml": "<field\n\ttype=\"subform\"\n\tname=\"ingredients\"\n\tlabel=\"The Ingredients List\"\n\tlayout=\"joomla.form.field.subform.repeatable-table\"\n\tcomponent=\"\"\n\tclient=\"\"\n\tmultiple=\"true\"\n\tbuttons=\"add,remove,move\"\n\tfields=\"69ffb53e-521a-48c9-a158-2c0e82837cf1,e05f7665-ce58-448b-bfee-17a957723961\"\n\tformsource=\"\"\n\tdescription=\"\"\n\tdefault=\"\"\n\ticon=\"list\"\n\tmax=\"50\"\n\tmin=\"1\"\n\tfilter=\"\"\n\tshowon=\"\"\n\/>", "datalenght": "", "javascript_view_footer": "", "css_views": "", "css_view": "", "datadefault_other": "", "datadefault": "", "datalenght_other": "", "javascript_views_footer": "", "add_css_view": 0, "add_css_views": 0, "add_javascript_view_footer": 0, "add_javascript_views_footer": 0, "initiator_on_save_model": "", "guid": "fb14a5b4-e9a4-45c3-aa4d-bc7639e7760f", "@dependencies": [ { "key": "guid", "value": "7139f2c8-a70a-46a6-bbe3-4eefe54ca515", ----> This is the Subform Fieldtype "entity": "fieldtype", "table": "#__componentbuilder_fieldtype", "direction": "out" }, { "key": "field", "value": "69ffb53e-521a-48c9-a158-2c0e82837cf1", ----> This is the linked Field that is missing "entity": "guid", "table": "#__componentbuilder_field", "direction": "out" }, { "key": "field", "value": "e05f7665-ce58-448b-bfee-17a957723961", ----> This is the linked Field that is missing "entity": "guid", "table": "#__componentbuilder_field", "direction": "out" } ] } ``` Here is a screenshot of the fields in the package repository and as can be clearly seen, there is only the subform and not the other two linked fields: ![image.png](https://git.vdm.dev/attachments/7e2bb780-4b68-4327-a683-203252ddc1de) ### Steps to reproduce the Bug Create a Subform field with linked Fields that are not linked to any other area than the subform and push that Subform to a package repository. ### Which Joomla version are you compiling in? v5.3.2 ### Which PHP version are you compiling in? v8.3 ### Which Joomla versions are you targeting? v5.1.2-alpha1 ### Which PHP version are you targeting? v8.3 ### Which Web server is JCB running on? Latest ### Which Relational Database is JCB running on? 11.4.3-MariaDB-ubu2404 ### Which OS is JCB running on? Ubuntu 24.04 LTS ### Which JCB version are you using? v5.1.2-alpha1 ### Where in JCB did this issue occur? Other ### On which browsers did you encounter the issue? Firefox ### Additional Comments When I `var_dump` the `$dependencies` in the [item function](https://git.vdm.dev/joomla/Component-Builder/src/commit/45453f733054d606e78d7d2ec2c3f515fe359694/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Package/Builder/Set.php#L76) I get the following: ``` array(2) { ["fieldtype"]=> array(1) { ["guid|7139f2c8-a70a-46a6-bbe3-4eefe54ca515"]=> array(5) { ["key"]=> string(4) "guid" ["value"]=> string(36) "7139f2c8-a70a-46a6-bbe3-4eefe54ca515" ["entity"]=> string(9) "fieldtype" ["table"]=> string(29) "#__componentbuilder_fieldtype" ["direction"]=> string(3) "out" } } ["guid"]=> array(2) { ["field|69ffb53e-521a-48c9-a158-2c0e82837cf1"]=> array(5) { ["key"]=> string(5) "field" ["value"]=> string(36) "69ffb53e-521a-48c9-a158-2c0e82837cf1" ["entity"]=> string(4) "guid" ["table"]=> string(25) "#__componentbuilder_field" ["direction"]=> string(3) "out" } ["field|e05f7665-ce58-448b-bfee-17a957723961"]=> array(5) { ["key"]=> string(5) "field" ["value"]=> string(36) "e05f7665-ce58-448b-bfee-17a957723961" ["entity"]=> string(4) "guid" ["table"]=> string(25) "#__componentbuilder_field" ["direction"]=> string(3) "out" } } } ``` Dependencies are found... Also in the [Remote/Set.php](https://git.vdm.dev/joomla/Component-Builder/src/branch/5.x/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Remote/Set.php) class, when I push the subform field and it already exists in the repo, but its dependencies does not, it triggers the [updateItem](https://git.vdm.dev/joomla/Component-Builder/src/commit/45453f733054d606e78d7d2ec2c3f515fe359694/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Remote/Set.php#L75) and returns `NO CHANGE: Field item [Ingredients (Subform)] in repo (https://github.com/repo/JCB_package) is already in sync.`
Lemuel added the
Bug
label 2025-07-24 21:01:41 +00:00
Author
Member

So after some more debugging on this, with help from @Llewellyn we identified the issue.

In the Dependency/Resolver.php at the function that identifies a subform dependency fields that was a small typo...

$this->record(
	'parent',
	'guid',   <-
	$field,
	'#__componentbuilder_field',
	'field'   <-
);

the above array should change to...

$this->record(
	'parent',
	'field',    <-
	$field,
	'#__componentbuilder_field',
	'guid'    <-
);

A simple issue like that...
We will release the fix with the next JCB alpha2.

So after some more debugging on this, with help from @Llewellyn we identified the issue. In the [Dependency/Resolver.php](https://git.vdm.dev/joomla/Component-Builder/src/commit/45453f733054d606e78d7d2ec2c3f515fe359694/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Package/Dependency/Resolver.php#L360) at the function that identifies a subform dependency fields that was a small typo... ``` $this->record( 'parent', 'guid', <- $field, '#__componentbuilder_field', 'field' <- ); ``` the above array should change to... ``` $this->record( 'parent', 'field', <- $field, '#__componentbuilder_field', 'guid' <- ); ``` A simple issue like that... We will release the fix with the next JCB alpha2.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1239
No description provided.