We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37905
    • 13 Posts
    Really I don't understand what is field "Join alias" and "Joins".
    Can you show stupid exapmle, what it do?
      • 4172
      • 5,888 Posts
      joins is to join other tables to the main-table, if you want to use them in the grid, for example.

      lets say you have a CMP for managing users with classname: 'modUser'
      you can join the profile-table with

      joins:
      [{"alias":"Profile"}]

      or if you want join with tables where the relations are not defined in the schema
      [{"alias":"Profile"},{"alias":"ExtendedProfile","classname":"myExtendedProfile","on":"ExtendedProfile.user_id=modUser.id"}]


      joinalias can be used in some situations where you have one/many relations and you want to update the relation-field automatically in combination with a (custom)-update-processor





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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 16313
        • 71 Posts
        Quote from: Bruno17 at May 29, 2013, 07:18 AM
        did you try

        [{"alias":"Product"},{"alias":"Category"}]
        sorry, no
        I tried this one:
        [{"alias":"Product","alias":"Category"}]
          • 16313
          • 71 Posts
          Another question.
          how can I join two migx tables?
          for example I have two tables modx_jj_categories(class: Jj_categories) and modx_jj_comp(class: Jj_comp)
          I try to join jj_categories in jj_comp.
          [{"classname":"Jj_categories","alias":"Category","on":"Category.id=category"}]

          but I get following error:
          Could not load class: Jj_categories from mysql.jj_categories.
          Jj_categories::getSelectColumns() is not a valid static method.
          what is wrong?
          thank you for assistance Bruno.
            • 4172
            • 5,888 Posts
            sounds like the package for this class is not loaded.

            are all your tables defined in the same schema?
            whats you schema?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 16313
              • 71 Posts
              Quote from: Bruno17 at Jun 18, 2013, 01:34 PM
              sounds like the package for this class is not loaded.

              are all your tables defined in the same schema?
              whats you schema?
              you're right. I added Jj_categories to schema and it works. But field name from table jj_categories does not appear.
              I call it as Category_name
              My schema is:
              <object class="Jj_categories" table="jj_categories" extends="xPDOSimpleObject">
              		 <field key="id" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              	</object>
              
              	<object class="Jj_comp" table="jj_comp" extends="xPDOSimpleObject">
              
              		<field key="name_de" dbtype="varchar" precision="255" phptype="string" null="true" />
              		<field key="name_en" dbtype="varchar" precision="255" phptype="string" null="true" />
              		<field key="category" dbtype="varchar" precision="255" phptype="string" null="true" />
              		<field key="url" dbtype="varchar" precision="255" phptype="string" null="true" />
              		<field key="image" dbtype="text" phptype="string" null="true" />
              		<field key="descr_de" dbtype="text" phptype="string" null="true" />
              		<field key="descr_en" dbtype="text" phptype="string" null="true" />
              		<field key="tags_de" dbtype="text" phptype="string" null="true" />
              		<field key="tags_en" dbtype="text" phptype="string" null="true" />
              
              		<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
              		<field key="createdby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              		<field key="createdon" dbtype="datetime" phptype="datetime" null="false" />
              		<field key="editedby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              		<field key="editedon" dbtype="datetime" phptype="datetime" null="false" />
              		<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
              		<field key="deletedon" dbtype="datetime" phptype="datetime" null="false" />
              		<field key="deletedby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              		<field key="publishedon" dbtype="datetime" phptype="datetime" null="false" />
              		<field key="publishedby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
              	</object>
              
                • 4172
                • 5,888 Posts
                I can't see the field 'name' in your schema. Is it there?

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

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 16313
                  • 71 Posts
                  Quote from: Bruno17 at Jun 18, 2013, 02:42 PM
                  I can't see the field 'name' in your schema. Is it there?

                  thanks, I added name field and it works like a charm smiley
                  I thought the tables jointed by category ID
                    • 39036
                    • 28 Posts
                    I’m learning how to use MigxDB by experimenting with joining and editing tables in the 'modx' package before creating my own.
                    I’ve set up a CMP for managing users, joining the moduser to modUserProfile by using
                     [{"alias":"Profile"}]

                    I can successfully list the data from both tables using field names for the alias table Profile_fullname, Profile_email etc. These alias fields I’ve also added to the Formtabs.

                    I've picked up a lot from the forums and the discussions here but...

                    My question is how do I add data to or edit the fields in the alias table (Profile), I’ve tried with no success but I can edit and update the moduser table OK, there are no errors so I’m missing a trick here? Has it something to do with custom processors?

                    Can anyone shed some light on this? [ed. note: littleseal last edited this post 12 years, 4 months ago.]
                      • 4172
                      • 5,888 Posts
                      have a look to this one:
                      https://github.com/Bruno17/migxclientmanager
                      especially to this:
                      https://github.com/Bruno17/migxclientmanager/blob/master/core/components/migxclientmanager/processors/mgr/default/update.php

                      its a simple example, how its possible to manage users with a MIGXdb - CMP
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!