relation model name: Model_1Database table name: #_testtableRelation to: SourceModelOne matching record, foreign key in related modelSourceModel.id = Model_1.mod_idExample not working:read data: read_tableall matchingSourceTable Model: SourceModelID: SourceModel.idin relation >relation model name: Model_1Database table name: #_testtableRelation to: SourceModelOne matching record, foreign key in related modelSourceModel.id = Model_1.mod_idrelation model name: Model_2Database table name: #_datatableRelation to: Model_1One matching record, foreign key in related modelModel_2.data_id = Model_1.mod_idHow does model relation work from the "2nd level"?F."> Model Relation Problem - Forums

Forums

Model Relation Problem

Fredolino 27 Feb, 2023
Hello

I found a problem with "Model Relation".
Model relation only works if the key of a DB table is linked to the source table.

Example works:

read data: read_table
all matching
SourceTable Model: SourceModel
ID: SourceModel.id

in relation >

relation model name: Model_1
Database table name: #_testtable
Relation to: SourceModel
One matching record, foreign key in related model
SourceModel.id = Model_1.mod_id


Example not working:

read data: read_table
all matching
SourceTable Model: SourceModel
ID: SourceModel.id

in relation >

relation model name: Model_1
Database table name: #_testtable
Relation to: SourceModel
One matching record, foreign key in related model
SourceModel.id = Model_1.mod_id

relation model name: Model_2
Database table name: #_datatable
Relation to: Model_1
One matching record, foreign key in related model
Model_2.data_id = Model_1.mod_id


How does model relation work from the "2nd level"?

F.
Fredolino 28 Feb, 2023
Hello,

is this a bug?? When will it be fixed? Will CF7 ever be fixed?
You're stuck between tree and bark because CC/CF6 doesn't work as well with PHP8 as it hasn't been developed with PHP7 and CF7 for ages...
Fredolino 28 Feb, 2023
it works in the case when the "Related to" field is not filled and the model name is entered in the "Table field name" (Model.table_field_name).

F.
You need to login to be able to post a reply.