silverstripe-populate
silverstripe-populate copied to clipboard
PopulateMergeMatch with HasOne?
Might be this might be more of a feature request than an issue: I tried to define a PopulateMergeMatch using ForeignKey Fields, but it did not work. I tried the following yams-code (Mandant & Plan are separate Objects)
Contract:
bronze:
Start: '2016-01-01 00:00:00'
End: '9999-12-31 23:59:59'
Mandant: =>Mandant.default
Plan: =>Plan.test
PopulateMergeMatch:
- Plan
- Mandant
This throws a n SQL-Error Unknown column 'Plan' in 'where clause'
because there is no such column in the Database. Changing the merge-fields to database-Columns like this:
PopulateMergeMatch:
- PlanID
- MandantID
yields a php runtime error of ERROR [Notice]: Undefined index: MandantID
because this field is not found in the yams definition. I can not use
PopulateMergeWhen: "MandantID = =>Mandant.default AND PlanID = =>Plan.test"
because the yaml -references will not be replaced with the real values.
Any idea how to achieve this?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.