We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48305
    • 58 Posts
    Hi,

    How can I create schema of existing table using MIGX? I have some form at which are connected with tables. Now client want to use CRUD operation on data of that form/tables. Now i want to use them with MIGX. So, How can i use those tables with MIGX?

    THNX
      • 4172
      • 5,888 Posts
      Are they in the same database as the MODX - tables?

      [Edit]
      And do they have a special table-prefix?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 48305
        • 58 Posts
        This is structure of my table? see attached file
          • 4172
          • 5,888 Posts
          is it only one table?
          where are the categories stored?
          what is the name of this table?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 48305
            • 58 Posts
            Other INT are my drop down value these have no tables... currently i need schema to that specific table...


              • 4172
              • 5,888 Posts
              1. I would change the name of the field post_ad_id to just 'id'
              2. Give your table another unique prefix, than modx_ (you can rename it later back)
              3. Go to the MIGX - CMP
              4. In the tab 'Package Manager' put a name for your new package (all lowercase without spaces) and table-prefix and select 'Custom Prefix'
              5. Under 'Create Package' click 'Create Package' - A new directory schould be created by that under core/components/yourpackage
              6. Under 'Write Schema' click 'Write Schema' - This should create your xpdo-schema
              7. Under 'Parse Schema' click 'Parse Schema' - This should create all needed stuff, class and map-files

              Now you are ready to use yor new created package with MIGXdb
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 48305
                • 58 Posts
                <?xml version="1.0" encoding="UTF-8"?>
                <model package="postads" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
                <object class="Postad" table="post_ad" extends="xPDOSimpleObject" >
                <field key="post_title" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
                <field key="post_parent_category" dbtype="varchar" precision="250" phptype="string" null="false" default="" />

                <field key="post_category" dbtype="int" precision="11" phptype="string" null="false" default="0" />
                <field key="post_sub_category" dbtype="int" precision="11" phptype="string" null="false" default="0" />

                <field key="post_postal_address" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                <field key="telephone" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                <field key="mobile" dbtype="varchar" precision="100" phptype="string" null="false" default="" />

                <field key="contact_email" dbtype="varchar" precision="150" phptype="string" null="false" default="" />
                <field key="city" dbtype="varchar" precision="100" phptype="string" null="false" default="" />


                <field key="country" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                <field key="price" dbtype="varchar" precision="50" phptype="string" null="false" default="" />


                <field key="ad_for" dbtype="int" precision="11" phptype="string" null="false" default="" />
                <field key="description" dbtype="varchar" precision="1000" phptype="string" null="false" default="" />


                <field key="user_id" dbtype="int" precision="11" phptype="string" null="false" default="" />
                <field key="address" dbtype="varchar" precision="1000" phptype="string" null="false" default="0" />






                <field key="deleted" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="" />
                <field key="published" dbtype="int" precision="1" attributes="unsigned" phptype="interger" null="false" default="" />
                </object>

                </model>


                this is schema...


                and which i wrote...

                and when I create it action after setting db and other MIGX setting. I got this error (error.png)


                In error Log I got these errors

                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) ::getSelectColumns() is not a valid static method.
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) Could not load class
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) No class specified for loadClass
                [2014-10-20 05:45:32] (ERROR @ /assets/components/migx/connector.php) ::loadCollection() is not a valid static method.
                  • 4172
                  • 5,888 Posts
                  what is the name of your table now?
                  what is your MIGX - Configuration, when you export it?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 48305
                    • 58 Posts
                    Table name is tbl_postad

                    My steps are

                    1) Create package as postads
                    2) Then paste schema and save
                    3) then parse schema then create table (table created successfully )
                    4) Then in MIGX tab setting->Name as (PostAds), unique MIGX ID as (postad)
                    5) Then CMP-setting main-caption (Post ad), Tab caption(Post Ads)
                    6) MIGXDB-setting package Name->(postads), Class Name->(Postad)
                    7) Setting->Action Lexicon Key Key->Post Ad, Action -> migx-index, Perameter->&configs=ad

                    These are my steps

                    <?xml version="1.0" encoding="UTF-8"?>
                    <model package="postads" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
                    <object class="Postad" table="postad" extends="xPDOSimpleObject" >
                    <field key="post_title" dbtype="varchar" precision="250" phptype="string" null="false" default="" />
                    <field key="post_parent_category" dbtype="varchar" precision="11" phptype="string" null="false" default="" />

                    <field key="post_category" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
                    <field key="post_sub_category" dbtype="int" precision="11" phptype="integer" null="false" default="0" />

                    <field key="post_postal_address" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                    <field key="telephone" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                    <field key="mobile" dbtype="varchar" precision="100" phptype="string" null="false" default="" />

                    <field key="contact_email" dbtype="varchar" precision="150" phptype="string" null="false" default="" />
                    <field key="city" dbtype="varchar" precision="100" phptype="string" null="false" default="" />


                    <field key="country" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
                    <field key="price" dbtype="varchar" precision="50" phptype="string" null="false" default="" />


                    <field key="ad_for" dbtype="int" precision="11" phptype="string" null="false" default="" />
                    <field key="description" dbtype="varchar" precision="1000" phptype="string" null="false" default="" />


                    <field key="user_id" dbtype="int" precision="11" phptype="string" null="false" default="" />
                    <field key="address" dbtype="varchar" precision="1000" phptype="string" null="false" default="0" />






                    <field key="deleted" dbtype="int" precision="1" attributes="unsigned" phptype="integer" null="false" default="" />
                    <field key="published" dbtype="int" precision="1" attributes="unsigned" phptype="interger" null="false" default="" />
                    </object>

                    </model>
                      • 4172
                      • 5,888 Posts
                      Quote from: mujtabaahmad1985 at Oct 20, 2014, 02:20 AM

                      Table name is tbl_postad

                      in MIGXdb - settings, you will need to select 'Custom Prefix' and add your prefix: 'tbl_'

                      or rename your table to 'modx_postad' now

                      Then you have to add some columns to the confiuration.
                      Don't forget to add the field 'id' to the columns-configuration!
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!