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>
31 lines
676 B
PHP
31 lines
676 B
PHP
<?php
|
|
|
|
namespace SilverStripe\ORM\Tests\ManyManyThroughListTest;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\ORM\DataObject;
|
|
use SilverStripe\ORM\ManyManyThroughList;
|
|
|
|
/**
|
|
* Basic parent object
|
|
*
|
|
* @property string $Title
|
|
* @method ManyManyThroughList Items()
|
|
*/
|
|
class TestObjectSubclass extends TestObject implements TestOnly
|
|
{
|
|
private static $table_name = 'ManyManyThroughListTest_TestObjectSubclass';
|
|
|
|
private static $db = [
|
|
'Title' => 'Varchar'
|
|
];
|
|
|
|
private static $many_many = [
|
|
'MoreItems' => [
|
|
'through' => PseudoPolyJoinObject::class,
|
|
'from' => 'Parent',
|
|
'to' => 'Child',
|
|
]
|
|
];
|
|
}
|