MIGX Joins Statements

Using the following schema:

<object class="Drzave" table="history_drzave" extends="xPDO\Om\xPDOSimpleObject">
    <field key="naziv" dbtype="varchar" phptype="string" precision="100" null="false" default=""/>
    <field key="short" dbtype="varchar" phptype="string" precision="100" null="false" default=""/>
    <field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />        
</object>

<object class="Tekmovalci" table="history_tekmovalci" extends="xPDO\Om\xPDOSimpleObject">
    <field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
    <field key="surname" dbtype="varchar" precision="255" phptype="string" null="false" default="" />

    <field key="drzava_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
    <aggregate alias="Drzava" class="History\Model\Drzave" local="drzava_id" foreign="id" cardinality="one" owner="foreign" />

    <field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />

    <index alias="drzava_id" name="drzava_id" primary="false" unique="false" type="BTREE" >
        <column key="drzava_id" length="" collation="A" null="false" />
    </index>

</object>

what is the correct way to construct a “join” clause for MIGX CMP? I’ve tried this and a bunch of other similar ones (without full class names … nothing worked). In the column, I am calling “drzava_short” to try and get the data, since that worked on MODX 2 without issues.

[{"alias":"drzava","classname":"History\Model\Drzave","on":"Tekmovalci.drzava_id = Drzava.id"}]

Using MODX 3.0.3, latest MIGX (3.0.2-beta1), PHP 8.1

Error log has:

No class specified for loadClass
No class specified for loadClass
::getSelectColumns() is not a valid static method.

so I believe it’s something I’m missing with my class definitions in the joins …

Just using [{"alias":"Drzava"}] worked. :slight_smile:

The problem here are the backslashes (\) that have to be escaped (to make it valid JSON).

This string in the “Joins” field should work as well:

[{"alias":"Drzava","classname":"History\\Model\\Drzave","on":"Tekmovalci.drzava_id = Drzava.id"}]

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.