Source of file CustomRelation.php
Size: 0,999 Bytes - Last Modified: 2021-12-23T10:35:47+00:00
/var/www/docs.ssmods.com/process/src/tests/php/VersionedOwnershipTest/CustomRelation.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php namespace SilverStripe\Versioned\Tests\VersionedOwnershipTest; use SilverStripe\Dev\TestOnly; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\Versioned\RecursivePublishable; use SilverStripe\Versioned\Versioned; /** * Object which is owned via a custom PHP method rather than DB relation * * @mixin RecursivePublishable * @mixin Versioned */ class CustomRelation extends DataObject implements TestOnly { private static $extensions = [ Versioned::class, ]; private static $table_name = 'VersionedOwnershipTest_CustomRelation'; private static $db = [ 'Title' => 'Varchar(255)', ]; private static $owned_by = [ 'Pages' ]; /** * All pages with the same number. E.g. 'Page 1' owns 'Custom 1' * * @return DataList */ public function Pages() { $title = str_replace('Custom', 'Page', $this->Title); return TestPage::get()->filter('Title', $title); } } |