Haha! Breakthrough!
I can now add items to the child table with [virtually] no errors!
So it seems where I was going wrong was in adding the whole child config from "Export/Import" to the parent MIGXdb TV config input. Instead I should have just added its name! Oops!
Issues I still have—
An error in the log:
(ERROR @ /assets/components/migx/connector.php) No foreign key definition for parentClass: xportfolio using relation alias: Resource
I can add items to the child but when I delete a parent item its child items stay in the DB. So how do I make the parent talk to the child table to remove them?
Schema
<?xml version="1.0" encoding="UTF-8"?>
<model package="xportfolio" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
<object class="xportfolio" table="xportfolio" extends="xPDOSimpleObject">
<field key="project" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="client" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="tags" dbtype="text" phptype="string" null="false" default=""/>
<field key="desc" dbtype="text" phptype="string" null="false" default=""/>
<field key="img" dbtype="text" phptype="string" null="false" default=""/>
<field key="img_sml" dbtype="text" phptype="string" null="false" default=""/>
<field key="url" dbtype="text" phptype="string" null="false" default=""/>
<field key="url_text" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="url_desc" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="promote" dbtype="tinyint" precision="1" phptype="integer" null="false" default="0"/>
<field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="0"/>
<field key="extended" dbtype="text" phptype="json" null="false" default=""/>
<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="1"/>
<index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
<column key="id" collation="A" null="false"/>
</index>
</object>
<object class="xportfolio_gal" table="xportfolio_gal" extends="xPDOSimpleObject">
<field key="gal_id" dbtype="int" precision="11" phptype="integer" null="true"/>
<field key="gal_img_title" dbtype="text" phptype="string" null="false" default=""/>
<field key="gal_img_desc" dbtype="text" phptype="string" null="false" default=""/>
<field key="gal_img" dbtype="text" phptype="string" null="false" default=""/>
<field key="gal_img_sml" dbtype="text" phptype="string" null="false" default=""/>
<field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="0"/>
<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0"/>
<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="1"/>
<aggregate alias="xportfolio_projects" class="xportfolio" local="gal_id" foreign="id" cardinality="one" owner="foreign"/>
<index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
<column key="id" collation="A" null="false"/>
</index>
</object>
</model>
Config (Parent)
{
"formtabs":[
{
"MIGX_id":1,
"caption":"Info",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":2,
"field":"project",
"caption":"Project",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":1,
"field":"gallery",
"caption":"Gallery Images",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"migxdb",
"configs":"xportfolio_gal",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
}
]
}
],
"contextmenus":"update||publish||unpublish||remove",
"actionbuttons":"addItem",
"columnbuttons":"",
"filters":"[]",
"extended":{
"migx_add":"Add Project",
"formcaption":"",
"update_win_title":"Portfolio",
"win_id":"xportfolio",
"maxRecords":"",
"multiple_formtabs":"",
"extrahandlers":"",
"packageName":"xportfolio",
"classname":"xportfolio",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":"0",
"check_resid_TV":"",
"join_alias":"",
"getlistwhere":"",
"joins":"",
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderoptions":"[]"
},
{
"MIGX_id":3,
"header":"Project",
"dataIndex":"project",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderoptions":"[]"
}
]
}
Config (Child)
{
"formtabs":[
{
"MIGX_id":1,
"caption":"Image",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":1,
"field":"gal_img_title",
"caption":"Title",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":2,
"field":"gal_img_desc",
"caption":"Description",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
},
{
"MIGX_id":3,
"field":"gal_img_sml",
"caption":"Image - Small",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"image",
"configs":"",
"sourceFrom":"config",
"sources":"[]",
"inputOptionValues":"",
"default":""
}
]
}
],
"contextmenus":"update||publish||unpublish||remove",
"actionbuttons":"addItem",
"columnbuttons":"",
"filters":"[]",
"extended":{
"migx_add":"Add an Image",
"formcaption":"",
"update_win_title":"Add Images",
"win_id":"xportfolio_gal",
"maxRecords":"",
"multiple_formtabs":"",
"extrahandlers":"",
"packageName":"xportfolio",
"classname":"xportfolio_gal",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"xportfolio_projects",
"getlistwhere":"",
"joins":"",
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"Gal ID",
"dataIndex":"gal_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderoptions":"[]"
},
{
"MIGX_id":2,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderoptions":"[]"
},
{
"MIGX_id":3,
"header":"Title",
"dataIndex":"gal_img_title",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderoptions":"[]"
}
]
}
[ed. note: ram last edited this post 10 years, 9 months ago.]