Thank you for your reply,
MODX 3.1.2pl
MIGX 3.0.2-beta1
The TV was indeed set to MIGX, not MIGXdb!
After making this change, the TV does display the results of the Playlist table, and no longer the value of tmplvar_contentvalues.
Similarly, when a song is added to the list from the TV, the Playlist table is filled.
So it’s better, but there are still 2 problems:
- When adding items (from TV or CMP)
the ‘resource_id’ field doesn’t fill in correctly and remains at 0 (default value).
I think it’s coming from the MIGX config, since if I add elements from the snippet, the resource_id value is filled in correctly in the database. (and listed correctly in the TV or CMP).
- If I activate “Check Resource” in the MIGXdb-Settings to display only items where resource_id: the list remains completely empty.
There seems to be a problem with this resource_id field, but I don’t understand what it is, since when you use the snippet to add elements, it works fine.
The playlist Class :
<?xml version="1.0" encoding="UTF-8"?>
<model package="Qlive\Model" baseClass="xPDO\Om\xPDOObject" platform="mysql" defaultEngine="InnoDB" phpdoc-package="" version="3.0">
<object class="Playlist" table="qlive_playlists" extends="xPDO\Om\xPDOSimpleObject">
<field key="resource_id" dbtype="int" precision="10" phptype="integer" null="false" default=""/>
<field key="code_q" dbtype="varchar" precision="20" phptype="string" null="true" default=""/>
<field key="titre" dbtype="varchar" precision="191" phptype="string" null="true" default=""/>
<field key="interprete" dbtype="varchar" precision="191" phptype="string" null="true" default=""/>
<field key="horodatage" dbtype="datetime" phptype="datetime" null="true"/>
<field key="statut" dbtype="int" precision="10" phptype="integer" null="false" default=""/>
</object>
</model>
The MIGX config
{
"formtabs":[
{
"MIGX_id":5,
"caption":"Une playlist",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":32,
"field":"id",
"caption":"id",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"none",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
},
{
"MIGX_id":33,
"field":"resource_id",
"caption":"resource_id",
"pos":2
},
{
"MIGX_id":34,
"field":"code_q",
"caption":"code_q",
"pos":3
},
{
"MIGX_id":35,
"field":"titre",
"caption":"titre",
"pos":4
},
{
"MIGX_id":36,
"field":"interprete",
"caption":"interprete",
"pos":5
},
{
"MIGX_id":37,
"field":"horodatage",
"caption":"horodatage",
"pos":6
},
{
"MIGX_id":38,
"field":"statut",
"caption":"statut",
"pos":7
}
],
"pos":1
}
],
"contextmenus":"update||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||remove",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"",
"maxRecords":"",
"addNewItemAt":"bottom",
"media_source_id":"",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"Qlive\\Model",
"classname":"Qlive\\Model\\Playlist",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"",
"has_jointable":"yes",
"getlistwhere":"",
"joins":"",
"hooksnippets":"",
"cmpmaincaption":"Playlists",
"cmptabcaption":"Playlists",
"cmptabdescription":"liste des morceau jou\u00e9s",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"permissions":{
"apiaccess":"",
"view":"",
"list":"",
"save":"",
"create":"",
"remove":"",
"delete":"",
"publish":"",
"unpublish":"",
"viewdeleted":"",
"viewunpublished":""
},
"fieldpermissions":"",
"columns":[
{
"MIGX_id":2,
"dataIndex":"id",
"header":"id"
},
{
"MIGX_id":3,
"dataIndex":"resource_id",
"header":"resource_id"
},
{
"MIGX_id":4,
"dataIndex":"code_q",
"header":"code_q"
},
{
"MIGX_id":5,
"dataIndex":"titre",
"header":"titre"
},
{
"MIGX_id":6,
"dataIndex":"interprete",
"header":"interprete"
},
{
"MIGX_id":7,
"dataIndex":"horodatage",
"header":"horodatage"
},
{
"MIGX_id":8,
"dataIndex":"statut",
"header":"statut"
}
],
"category":""
}
the snippet used to add items to the playlist
$track = $modx->newObject(Playlist::class);
$track->set('code_q', 'CODE-Q');
$track->set('titre', 'titre');
$track->set('interprete', 'artiste');
$track->set('statut', '1');
$track->set('horodatage', '2025-04-25 12:03');
$track->set('resource_id', '12');
$track->save();
another interesting clue:
If in MIGXdb-Setting I select Check Resource=YES
- the TV list is empty
- when an item is added from the TV or CMP, the resource_id value is correctly entered in the database.
If I select Check Resource=NO in MIGXdb-Setting
- the TV list displays all items
- when an item is added from the TV or CMP, the resource_id value remains at 0 in the database.