We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37108
    • 80 Posts
    I'm sure I'm just missing something simple here, but with the following schema and configs I'm getting records incorrectly written to my vcSections (parent) table (with the id of the newly-created vcSubsections record being written to the resource_id column in the vcSections table [empty values for the rest of the columns]). Where have I gone wrong?

    Schema (relevant parts shown):
    <object class="vcSections" table="cct_vc_sections" extends="xPDOSimpleObject">
    
            <field key="sectionheading" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="fulltext" indexgrp="sections_ft_idx" />
            <field key="sectionshortheading" dbtype="varchar" precision="255" phptype="string" null="true" default="" index="fulltext" indexgrp="sections_ft_idx" />
    		<field key="sectioncontent" dbtype="text" phptype="string" null="false" index="fulltext" indexgrp="sections_ft_idx" />
    		
    		<field key="sectionindex" dbtype="smallint" precision="2" attributes="unsigned" phptype="integer" null="true" default="0" />
    
    		<field key="resource_id" dbtype="int" precision="11" phptype="integer" null="false" default="" />
    
            <field key="createdon" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="" />
            <field key="modifiedon" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="true" default="" />
    
    		<index alias="sections_ft_idx" name="sections_ft_idx" primary="false" unique="false" type="FULLTEXT">
                <column key="sectionheading" length="" collation="A" null="false" />
                <column key="sectionshortheading" length="" collation="A" null="true" />
                <column key="sectioncontent" length="" collation="A" null="false" />
            </index>
    		
    		<aggregate alias="Resource" class="modResource" local="resource_id" foreign="id" cardinality="one" owner="foreign" />
    		<composite alias="Subsections" class="vcSubsections" local="id" foreign="section_id" cardinality="many" owner="local" />
    
        </object>
        
        <object class="vcSubsections" table="cct_vc_subsections" extends="xPDOSimpleObject">
    
            <field key="subsectionheading" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="fulltext" indexgrp="subsections_ft_idx" />
            <field key="subsectionshortheading" dbtype="varchar" precision="255" phptype="string" null="true" default="" index="fulltext" indexgrp="subsections_ft_idx" />
    		<field key="subsectioncontent" dbtype="text" phptype="string" null="false" index="fulltext" indexgrp="subsections_ft_idx" />
    		
    		<field key="subsectionindex" dbtype="smallint" precision="2" attributes="unsigned" phptype="integer" null="true" default="0" />
    
    		<field key="section_id" dbtype="smallint" precision="2" phptype="integer" null="false" default="" />
    
            <field key="createdon" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="" />
            <field key="modifiedon" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="true" default="" />
    
    		<index alias="subsections_ft_idx" name="subsections_ft_idx" primary="false" unique="false" type="FULLTEXT">
                <column key="subsectionheading" length="" collation="A" null="false" />
                <column key="subsectionshortheading" length="" collation="A" null="true" />
                <column key="subsectioncontent" length="" collation="A" null="false" />
            </index>
    		
    		<aggregate alias="Section" class="vcSections" local="section_id" foreign="id" cardinality="one" owner="foreign" />
    
        </object>
    


    Config (vcSections):
    {
      "formtabs":[
        {
          "MIGX_id":1,
          "caption":"Main Content Sections",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":1,
              "field":"sectionheading",
              "caption":"Section Heading",
              "description":"Main content section heading; A link to this section is added automatically to the article TOC",
              "description_is_code":"0",
              "inputTV":"sectionheading",
              "inputTVtype":"text",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":4,
              "field":"sectionshortheading",
              "caption":"Section Short Heading",
              "description":"Optional; Produces a shortened heading\/title for use in navigation areas",
              "description_is_code":"0",
              "inputTV":"periodical-section-shortheading",
              "inputTVtype":"textbox",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":2,
              "field":"sectioncontent",
              "caption":"Section Content",
              "description":"",
              "description_is_code":"0",
              "inputTV":"periodical-content-section",
              "inputTVtype":"richtext",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":5,
              "field":"nested_subsections",
              "caption":"Subsections",
              "description":"",
              "description_is_code":"0",
              "inputTV":"periodical-content-subsections",
              "inputTVtype":"migxdb",
              "validation":"",
              "configs":"varcontent-subsections",
              "restrictive_condition":"",
              "display":"",
              "sourceFrom":"config",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":3,
              "field":"sectionindex",
              "caption":"Section Index",
              "description":"Use this field to set the order in which sections are displayed",
              "description_is_code":"0",
              "inputTV":"periodical-content-sectionindex",
              "inputTVtype":"number",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            }
          ]
        }
      ],
      "contextmenus":"update||duplicate||remove",
      "actionbuttons":"addItem",
      "columnbuttons":"",
      "filters":"[]",
      "extended":{
        "migx_add":"Add Section",
        "formcaption":"Section Settings and Content",
        "update_win_title":"Content Editor",
        "win_id":"periodicals_variablecontent_sections",
        "maxRecords":"",
        "addNewItemAt":"bottom",
        "multiple_formtabs":"",
        "actionbuttonsperrow":4,
        "winbuttonslist":"",
        "extrahandlers":"",
        "filtersperrow":4,
        "packageName":"varcontent",
        "classname":"vcSections",
        "task":"vcsections",
        "getlistsort":"",
        "getlistsortdir":"",
        "use_custom_prefix":"0",
        "prefix":"",
        "grid":"",
        "gridload_mode":2,
        "check_resid":1,
        "check_resid_TV":"",
        "join_alias":"",
        "has_jointable":"yes",
        "getlistwhere":"",
        "joins":"",
        "cmpmaincaption":"",
        "cmptabcaption":"",
        "cmptabdescription":"",
        "cmptabcontroller":"",
        "winbuttons":"",
        "onsubmitsuccess":"",
        "submitparams":""
      },
      "columns":[
        {
          "MIGX_id":1,
          "header":"Section Index",
          "dataIndex":"sectionindex",
          "width":50,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"[]"
        },
        {
          "MIGX_id":2,
          "header":"Section Heading",
          "dataIndex":"sectionheading",
          "width":400,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"[]"
        },
        {
          "MIGX_id":3,
          "header":"ID",
          "dataIndex":"id",
          "width":"",
          "sortable":"false",
          "show_in_grid":"0",
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"[]"
        }
      ]
    }
    


    Config (vcSubsections):
    {
      "formtabs":[
        {
          "MIGX_id":1,
          "caption":"Main Content Subsections",
          "print_before_tabs":"0",
          "fields":[
            {
              "MIGX_id":1,
              "field":"subsectionheading",
              "caption":"Subsection Heading",
              "description":"Main content subsection heading; A link to this subsection is added automatically to the article TOC",
              "description_is_code":"0",
              "inputTV":"subsectionheading",
              "inputTVtype":"text",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":4,
              "field":"subsectionshortheading",
              "caption":"Subsection Short Heading",
              "description":"Optional; Produces a shortened heading\/title for use in navigation areas",
              "description_is_code":"0",
              "inputTV":"periodical-subsection-shortheading",
              "inputTVtype":"textbox",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":2,
              "field":"subsectioncontent",
              "caption":"Subsection Content",
              "description":"",
              "description_is_code":"0",
              "inputTV":"periodical-content-subsection",
              "inputTVtype":"richtext",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            },
            {
              "MIGX_id":3,
              "field":"subsectionindex",
              "caption":"Subsection Index",
              "description":"Use this field to set the order in which subsections are displayed",
              "description_is_code":"0",
              "inputTV":"periodical-content-subsectionindex",
              "inputTVtype":"number",
              "validation":"",
              "configs":"",
              "sourceFrom":"tv",
              "sources":"[]",
              "inputOptionValues":"",
              "default":""
            }
          ]
        }
      ],
      "contextmenus":"update||duplicate||remove",
      "actionbuttons":"addItem",
      "columnbuttons":"",
      "filters":"[]",
      "extended":{
        "migx_add":"Add Subsection",
        "formcaption":"Subsection Settings and Content",
        "update_win_title":"Content Editor",
        "win_id":"periodicals_variablecontent_subsections",
        "maxRecords":"",
        "addNewItemAt":"bottom",
        "multiple_formtabs":"",
        "actionbuttonsperrow":4,
        "winbuttonslist":"",
        "extrahandlers":"",
        "filtersperrow":4,
        "packageName":"varcontent",
        "classname":"vcSubsections",
        "task":"vcsubsections",
        "getlistsort":"",
        "getlistsortdir":"",
        "use_custom_prefix":"0",
        "prefix":"",
        "grid":"",
        "gridload_mode":2,
        "check_resid":1,
        "check_resid_TV":"",
        "join_alias":"Section",
        "has_jointable":"yes",
        "getlistwhere":"",
        "joins":"",
        "cmpmaincaption":"",
        "cmptabcaption":"",
        "cmptabdescription":"",
        "cmptabcontroller":"",
        "winbuttons":"",
        "onsubmitsuccess":"",
        "submitparams":""
      },
      "columns":[
        {
          "MIGX_id":1,
          "header":"Subsection Index",
          "dataIndex":"subsectionindex",
          "width":50,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"[]"
        },
        {
          "MIGX_id":2,
          "header":"Subsection Heading",
          "dataIndex":"subsectionheading",
          "width":400,
          "sortable":true,
          "show_in_grid":1,
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"[]"
        },
        {
          "MIGX_id":3,
          "header":"ID",
          "dataIndex":"id",
          "width":"",
          "sortable":"false",
          "show_in_grid":"0",
          "renderer":"",
          "clickaction":"",
          "selectorconfig":"",
          "renderchunktpl":"",
          "renderoptions":"[]"
        }
      ]
    }
    

    This question has been answered by Bruno17. See the first response.

      • 4172
      • 5,888 Posts
      do you have custom - update-processors?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37108
        • 80 Posts
        Yes, I do. I did check these against the latest release default processors. The only change in my processor is to the creation and mod dates.
        • discuss.answer
          • 4172
          • 5,888 Posts
          what happens when you set the MIGXdb - setting

          "has_jointable":"yes",


          to "no" ?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 37108
            • 80 Posts
            OK, that fixes it. When should it be set to "yes" normally?

            On another note I noticed that the action "duplicate" only updates the chosen record. Does one need to write their own duplicate processor for it to work?

            Thanks so much, Bruno!
              • 4172
              • 5,888 Posts
              Needs to be set to "yes", if you have a join-table, which connects records of two tables,
              for example many2many - relationships between Resources and news,banners,products... in a custom-table

              not duplicating is/was a bug introduced with one of the last commits, its fixed here:
              https://github.com/Bruno17/MIGX/commit/6fdf2ed17ef76ca240b99b35f95e56968a57b399
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 37108
                • 80 Posts
                Thanks...yes, I just caught that commit in another post and applied it. While testing, I did find that if you duplicate a record that has a nested migxdb element that the nested element's records do not get duplicated. I'll continue questions about this in another thread... [ed. note: smg6511v2 last edited this post 12 years, 6 months ago.]