We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44580
    • 189 Posts
    Hi,
    I've create a migxdb package and all seems to be as it should. However, when I create the CMP, it is coming up as "undefined". I am also getting the following errors every time I access the CMP:

    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) ::getSelectColumns() is not a valid static method.
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) Could not load class
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
    [2014-08-11 14:31:58] (ERROR @ /assets/components/migx/connector.php) ::loadCollection() is not a valid static method.


    This is what I did:

    1. Created my own database tables manually (prefixed with add_)
    2. In Package manager
    - Package name: add
    - table-prefix: custom
    - custom-prefix: add
    3. Clicked on 'Create Package'
    4. Clicked on 'Write Schema'
    5. Clicked on 'parse Schema'
    6. Clicked on 'Load Schema'. The xml loaded and contained all my tables as I expected.

    This is my schema (partial because I am only looking at the first table at this point):

    <?xml version="1.0" encoding="UTF-8"?>
    <model package="add" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
    	<object class="CoachDetails" table="_coach_details" extends="xPDOSimpleObject">
    		<field key="coach_id" dbtype="int" precision="11" phptype="integer" null="false" index="unique" />
    		<field key="coach_bio" dbtype="varchar" precision="1000" phptype="string" null="true" />
    		<field key="makeup_1" dbtype="varchar" precision="45" phptype="string" null="true" />
    		<field key="makeup_2" dbtype="varchar" precision="45" phptype="string" null="true" />
    		<field key="makeup_3" dbtype="varchar" precision="45" phptype="string" null="true" />
    
    		<index alias="coach_id_idx" name="coach_id_idx" primary="false" unique="true" type="BTREE" >
    			<column key="coach_id" length="" collation="A" null="false" />
    		</index>
                    <aggregate alias="Coach" class="modUser" local="coach_id" foreign="id" cardinality="one" owner="foreign" />
    	</object>


    Next, I went to the MIGX tab and created an item. In that item I gave it a name and a unique migx id of hca.coach.details (both the same).

    Under Formtabs I added an item and added a field for each column in my table using the column names from the table. I then clicked on the ContextMenus and Action buttons I wanted. Under Migxdb-settings I put Package name: add, Classname: CoachDetails and custom prefix: add. All other fields were left as default.

    I then proceeded to create the menu item with the following settings:

    - Lexicon key: Coach Details
    - Action: index
    - Parameters: &configs=coachDetails
    - Namespace: Migx.

    And there you have it. Sorry for the excessively long explanation, but I wanted to be thorough.

    Help please.

    Robert.

    (Revo: 2.3.1, MIGX: 2.8.1)


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

    [ed. note: gissirob last edited this post 10 years, 5 months ago.]
      • 4172
      • 5,888 Posts
      This configuration is working for me with your xpdo-schema:

      {
        "formtabs":[
          {
            "MIGX_id":68,
            "caption":"add",
            "print_before_tabs":"0",
            "fields":[
              {
                "MIGX_id":322,
                "field":"coach_bio",
                "caption":"Bio",
                "description":"",
                "description_is_code":"0",
                "inputTV":"",
                "inputTVtype":"",
                "validation":"",
                "configs":"",
                "restrictive_condition":"",
                "display":"",
                "sourceFrom":"config",
                "sources":"",
                "inputOptionValues":"",
                "default":"",
                "pos":1
              }
            ],
            "pos":1
          }
        ],
        "contextmenus":"update||remove",
        "actionbuttons":"addItem",
        "columnbuttons":"",
        "filters":"",
        "extended":{
          "migx_add":"",
          "disable_add_item":"",
          "formcaption":"",
          "update_win_title":"",
          "win_id":"add",
          "maxRecords":"",
          "addNewItemAt":"bottom",
          "multiple_formtabs":"",
          "actionbuttonsperrow":4,
          "winbuttonslist":"",
          "extrahandlers":"",
          "filtersperrow":4,
          "packageName":"add",
          "classname":"CoachDetails",
          "task":"",
          "getlistsort":"",
          "getlistsortdir":"",
          "sortconfig":"",
          "gridpagesize":"",
          "use_custom_prefix":1,
          "prefix":"add",
          "grid":"",
          "gridload_mode":1,
          "check_resid":1,
          "check_resid_TV":"",
          "join_alias":"",
          "has_jointable":"yes",
          "getlistwhere":"",
          "joins":"",
          "cmpmaincaption":"Coaches",
          "cmptabcaption":"Coaches",
          "cmptabdescription":"Manage Coaches here",
          "cmptabcontroller":"",
          "winbuttons":"",
          "onsubmitsuccess":"",
          "submitparams":""
        },
        "columns":[
          {
            "MIGX_id":1,
            "header":"ID",
            "dataIndex":"id",
            "width":10,
            "sortable":"false",
            "show_in_grid":1,
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":""
          },
          {
            "MIGX_id":2,
            "header":"Bio",
            "dataIndex":"coach_bio",
            "width":50,
            "sortable":"false",
            "show_in_grid":1,
            "renderer":"",
            "clickaction":"",
            "selectorconfig":"",
            "renderchunktpl":"",
            "renderoptions":""
          }
        ]
      }
      


      btw:
      I think it doesn't matter, but it would look better with a prefix of 'add_' in your xpdo-schema:

      <object class="CoachDetails" table="coach_details" extends="xPDOSimpleObject">
      [ed. note: Bruno17 last edited this post 10 years, 5 months ago.]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 44580
        • 189 Posts
        Thanks Bruno. For the life of me I can't see where I'm going wrong. Here is my Json:
        {
          "formtabs":[
            {
              "MIGX_id":1,
              "caption":"Coach details",
              "print_before_tabs":"0",
              "fields":[
                {
                  "MIGX_id":1,
                  "field":"coach_bio",
                  "caption":"Coach Bio",
                  "description":"Biography of the coach",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "pos":1
                },
                {
                  "MIGX_id":2,
                  "field":"makeup_1",
                  "caption":"Lesson makeup day (1)",
                  "description":"The first day that can be used for making up lessons.",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"listbox",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"Monday==Monday||Tuesday==Tuesday||Wednesday==Wednesday||Thursday==Thursday||Friday==Friday||Saturday==Saturday||Sunday==Sunday",
                  "default":"",
                  "pos":2
                },
                {
                  "MIGX_id":3,
                  "field":"makeup_2",
                  "caption":"Lesson makeup day (2)",
                  "description":"The second day that can be used for making up lessons.",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"listbox",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"Monday==Monday||Tuesday==Tuesday||Wednesday==Wednesday||Thursday==Thursday||Friday==Friday||Saturday==Saturday||Sunday==Sunday",
                  "default":"",
                  "pos":3
                },
                {
                  "MIGX_id":4,
                  "field":"makeup_3",
                  "caption":"Lesson makeup day (3)",
                  "description":"The third day that can be used for making up lessons.",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"listbox",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"Monday==Monday||Tuesday==Tuesday||Wednesday==Wednesday||Thursday==Thursday||Friday==Friday||Saturday==Saturday||Sunday==Sunday",
                  "default":"",
                  "pos":4
                }
              ],
              "pos":1
            }
          ],
          "contextmenus":"update||remove",
          "actionbuttons":"addItem",
          "columnbuttons":"",
          "filters":"",
          "extended":{
            "migx_add":"Add coach details",
            "disable_add_item":"",
            "formcaption":"Add coach details",
            "update_win_title":"Add coach details",
            "win_id":"hca.coach.details",
            "maxRecords":"",
            "addNewItemAt":"bottom",
            "multiple_formtabs":"",
            "actionbuttonsperrow":4,
            "winbuttonslist":"done",
            "extrahandlers":"",
            "filtersperrow":4,
            "packageName":"add",
            "classname":"CoachDetails",
            "task":"",
            "getlistsort":"",
            "getlistsortdir":"",
            "sortconfig":"",
            "gridpagesize":"",
            "use_custom_prefix":1,
            "prefix":"add",
            "grid":"",
            "gridload_mode":1,
            "check_resid":1,
            "check_resid_TV":"",
            "join_alias":"",
            "has_jointable":"yes",
            "getlistwhere":"",
            "joins":"",
            "cmpmaincaption":"Coach Details",
            "cmptabcaption":"Coach info",
            "cmptabdescription":"",
            "cmptabcontroller":"",
            "winbuttons":"",
            "onsubmitsuccess":"",
            "submitparams":""
          },
          "columns":[
            {
              "MIGX_id":1,
              "header":"ID",
              "dataIndex":"id",
              "width":10,
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":2,
              "header":"Coach Bio",
              "dataIndex":"coach_bio",
              "width":50,
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":3,
              "header":"Makeup day 1",
              "dataIndex":"makeup_1",
              "width":12,
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":4,
              "header":"Makeup day 2",
              "dataIndex":"makeup_2",
              "width":12,
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":5,
              "header":"Makeup day 3",
              "dataIndex":"makeup_3",
              "width":12,
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            }
          ]
        }




        Quote from: Bruno17 at Aug 12, 2014, 05:48 AM
        btw:
        I think it doesn't matter, but it would look better with a prefix of 'add_' in your xpdo-schema:

        <object class="CoachDetails" table="coach_details" extends="xPDOSimpleObject">
        I'm not sure what you mean here. Are you suggesting that table="_coach_details" should be table="add_coach_details"? I was simply going with the schema that was generated by migx from my tables.

        Any further thoughts as to what might be causing the errors - which I'm still getting every time I access the CMP?
          • 44580
          • 189 Posts
          And some additional info...
          I went back and re-created everything, and when I went to Update Indexes, I got the following error:

          [2014-08-12 10:37:36] (ERROR in xPDOManager_mysql::addIndex @ /var/www/hca/core/xpdo/om/mysql/xpdomanager.class.php : 329) Error adding index member_id to MemberDetails: Array
          (
          [0] => 42S02
          [1] => 1146
          [2] => Table 'hca.hca__member_details' doesn't exist
          )


          which is interesting seeing as how I defined:

          - Package name: add
          - table-prefix: custom
          - custom-prefix: add

          in the migx package manager.

          It might appear that these are being ignored. BTW, my database name is hca, and my table prefix is hca_ for all the modx tables and add_ for all my additional tables. So why then is it trying to use a table hca.hca__member_details (note the two underscores) instead of hca.add_member_details?

          Yet when I used "Write schema" to generate my schema, all the correct tables (those with the add_ prefix) were picked up.
            • 4172
            • 5,888 Posts
            seems 'update indexes' doesn't respect the table prefix.
            This is a bug then, but hasn't todo with your other issues.

            This function is only needed when you had added index-definitions in the field definitions in your xpdo-schema and you want to add them to your tables

            As said above, you should add the underscore to your prefix

            should be

            add_

            not just

            add

            then you will have

            table="coach_details"

            not

            table="_coach_details"



              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • discuss.answer
              • 44580
              • 189 Posts
              Thanks Bruno.

              As per your suggestion, made the change to add_. While this made everything "cleaner", it did not fix the problem. The good news is that I managed to fix it anyway, so for any others who might be getting the same error, this is what I did:

              When I set up my Migx Config, I called it hca.coach.details. In sheer desperation, I renamed this to be CoachDetails and the errors disappeared. Apparently Migx does not like full-stops in names. I also deleted core/cache as a matter of course (not sure if this is needed or not).
                • 48530
                • 1 Posts
                J had the same "undefined" problem...

                My solution was to use the exactly same name for

                • MIGX -> Settings -> Name
                • MIGX -> Settings -> unique MIGX ID
                • MIGX -> MIGXdb -> Classname

                when the "MIGX -> Settings -> Name" and the "MIGX -> Settings -> unique MIGX ID" is different, the undefined error appears for me ...
                  • 54142
                  • 2 Posts
                  Quote from: rt1900 at Nov 30, 2014, 10:59 AM
                  J had the same "undefined" problem...

                  My solution was to use the exactly same name for

                  • MIGX -> Settings -> Name
                  • MIGX -> Settings -> unique MIGX ID
                  • MIGX -> MIGXdb -> Classname

                  when the "MIGX -> Settings -> Name" and the "MIGX -> Settings -> unique MIGX ID" is different, the undefined error appears for me ...


                  This did the job for me!
                  Thanks!