Referring to a parent in a new type, while it is already referred in a C3 type

#1

Trying to refer by parent to make a one to many relationship between a C3 type which is Bill and DetailedBillMMD that I define newly.
The issue when I proceed provisioning, I get this error:

Field detailedBills in type SummaryBill specifies an fkey of parent which is a reference to included
 type Bill in the field's reference type DetailedBillMMD
Field detailedBills in type TransformBillSummaryToSummaryBill specifies an fkey of parent which is a
 reference to included type Bill in the field's reference type DetailedBillMMD
Field detailedBills in type TransformBillDetailToDetailedBill specifies an fkey of parent which is a
 reference to included type Bill in the field's reference type DetailedBillMMD
Field detailedBills in type MeasurementDetailedBillMapping specifies an fkey of measurementLink whic
h is not defined in the field's reference type DetailedBill
Field detailedBills in type Bill specifies an fkey of parent which is a reference to included type B
ill in the field's reference type DetailedBillMMD
Field detailedBills in type DetailedBill specifies an fkey of parent which is a reference to include
d type Bill in the field's reference type DetailedBillMMD
Field detailedBills in type TransformCanonicalMeasurementMonthlyToBill specifies an fkey of parent w
hich is a reference to included type Bill in the field's reference type DetailedBillMMD
Field detailedBills in type StatementFooter specifies an fkey of parent which is a reference to incl
uded type Bill in the field's reference type DetailedBillMMD

for the following code:

entity type DetailedBillMMD schema name 'DB_MMD' {
  id   : string
  start   : datetime
  end : datetime
  parent  : Bill
}

and

remix type Bill {
  	@db(order='descending(start)')
  	detailedBills: [DetailedBillMMD](parent)
    ressource: string
    latest: datetime
    earliest: datetime
}

I see that the referred parent of type Bill in DetailedBillMMD, exists also in the type: SummaryBill. and in my understanding, this can’t happen otherwise we get a Bill with a list of DetailedBillMMD or SummaryBill. Which is a polymorphic array that I doubt C3 will accept, thus the error.

Sorry for explaining what it might be quickly explainable for you, but this is to ask if it is true.

What do you suggest as a solution as well ?

Thank you !

#2

It will not work because Bill is not an entity type, has no id field. If you do the same with SummaryBill or other persisted type it should work.

This is because SummaryBill mixes Bill.

1 Like
#3

Right, many thanks to you Bachr !