I've created a fixture file to test an element that I've created using Dna Design's Silverstripe Elemental package and Silverstripe seems to insist that the has_many
relationship 'Elements'
in ElementalArea
doesn't exist.
SilverStripe\ORM\Connect\DatabaseException: Couldn't run query:
INSERT INTO "ElementalArea"
("Elements")
VALUES
(?)
Unknown column 'Elements' in 'field list'
I have the fixture file:
---
MyElement:
my-element:
...
ElementalArea:
elemental-area:
Elements: =>MyElement.my-element
I've tried running sake /dev/build "flush=all"
and clearing /tmp/sivlerstripe-cache...
with no luck
In Silverstripe 4 the Elemental module is namespaced. In our fixture yml file we must provide the full namespaced path for ElementalArea
.
Also, on a has many relationship we can set the relationship on the has one side (the Element):
DNADesign\Elemental\Models\ElementalArea:
elemental-area:
Title: 'Area 1'
DNADesign\Elemental\Tests\Src\TestPage:
page1:
Title: 'Page 1'
URLSegment: 'test-page'
ElementalAreaID: =>DNADesign\Elemental\Models\ElementalArea.elemental-area
MyElement:
my-element:
Title: 'Element 1'
ParentID: =>DNADesign\Elemental\Models\ElementalArea.elemental-area