mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
50a0018363
```php class HomePage extends Page { private static $many_many = [ 'HeroImages' => [ 'through' => PageImageLink::class, 'from' => 'Page', 'to' => 'Image', ] ]; } ``` ```php class PageImageLink extends DataObject { private static $has_one = [ 'Page' => SiteTree::class, 'Image' => Image::class, ]; } This fails because the linking object's relation class doesn't exactly match the owner. Sharing the linking objects across various entries in the ancestry should be a supported use case. Co-authored-by: Aaron Carlino <unclecheese@leftandmain.com>
116 lines
4.1 KiB
YAML
116 lines
4.1 KiB
YAML
SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObject:
|
|
parent1:
|
|
Title: 'my object'
|
|
parent2:
|
|
Title: 'my object2'
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObjectSubclass:
|
|
parent1:
|
|
Title: 'my object'
|
|
parent2:
|
|
Title: 'my object2'
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\Item:
|
|
# Having this one first means the IDs of records aren't the same as the IDs of the join objects.
|
|
child0:
|
|
Title: 'not filtered'
|
|
child1:
|
|
Title: 'item 1'
|
|
child2:
|
|
Title: 'item 2'
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\JoinObject:
|
|
join1:
|
|
Title: 'join 1'
|
|
Sort: 4
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObject.parent1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child1
|
|
join2:
|
|
Title: 'join 2'
|
|
Sort: 2
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObject.parent1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child2
|
|
join3:
|
|
Title: 'join 3'
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObject.parent2
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child1
|
|
join4:
|
|
Title: 'join 4'
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObject.parent2
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child2
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\PseudoPolyJoinObject:
|
|
join1:
|
|
Title: 'join 1'
|
|
Sort: 4
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObjectSubclass.parent1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child1
|
|
join2:
|
|
Title: 'join 2'
|
|
Sort: 2
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObjectSubclass.parent1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child2
|
|
join3:
|
|
Title: 'join 3'
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObjectSubclass.parent2
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child1
|
|
join4:
|
|
Title: 'join 4'
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\TestObjectSubclass.parent2
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Item.child2
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyObjectA:
|
|
obja1:
|
|
Title: 'object A1'
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyObjectB:
|
|
objb1:
|
|
Title: 'object B1'
|
|
objb2:
|
|
Title: 'object B2'
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyItem:
|
|
child1:
|
|
Title: 'item 1'
|
|
child2:
|
|
Title: 'item 2'
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyJoinObject:
|
|
join1:
|
|
Title: 'join 1'
|
|
Sort: 4
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyObjectA.obja1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyItem.child1
|
|
join2:
|
|
Title: 'join 2'
|
|
Sort: 2
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyObjectA.obja1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyItem.child2
|
|
join3:
|
|
Title: 'join 3'
|
|
Sort: 2
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyObjectB.objb1
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyItem.child2
|
|
join4:
|
|
Title: 'join 4'
|
|
Sort: 2
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyObjectB.objb2
|
|
Child: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\PolyItem.child2
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\Locale:
|
|
international:
|
|
Title: 'International'
|
|
Locale: 'en_NZ'
|
|
URLSegment: 'international'
|
|
IsGlobalDefault: 1
|
|
mexico:
|
|
Title: 'Mexico'
|
|
Locale: 'es_MX'
|
|
URLSegment: 'mexico'
|
|
IsGlobalDefault: 0
|
|
argentina:
|
|
Title: 'Argentina'
|
|
Locale: 'es_AR'
|
|
URLSegment: 'argentina'
|
|
IsGlobalDefault: 0
|
|
SilverStripe\ORM\Tests\ManyManyThroughListTest\FallbackLocale:
|
|
mexico_international:
|
|
Sort: 2
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Locale.mexico
|
|
Locale: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Locale.international
|
|
mexico_argentina:
|
|
Sort: 1
|
|
Parent: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Locale.mexico
|
|
Locale: =>SilverStripe\ORM\Tests\ManyManyThroughListTest\Locale.argentina
|