Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace CWP\CWP\Model; | ||
|
||
use CWP\CWP\PageTypes\BasePage; | ||
use SilverStripe\ORM\DataObject; | ||
use SilverStripe\ORM\FieldType\DBInt; | ||
use SilverStripe\Versioned\Versioned; | ||
|
||
class RelatedPageLink extends DataObject | ||
{ | ||
private static $table_name = 'BasePage_RelatedPages'; | ||
|
||
private static $extensions = [ | ||
Versioned::class | ||
]; | ||
|
||
private static $db = [ | ||
'SortOrder' => DBInt::class | ||
]; | ||
|
||
/** | ||
* For backwards compatibility these must match a traditional 'many_many' definition. | ||
* This was BasePage.RelatedPages => BasePage | ||
* ManyMany relations are normally joined by ${DefiningClass}ID && ${RelatedClass}ID | ||
* excepting in the case where ${DefiningClass} === ${RelatedClass} | ||
* Then the 'related class' column changes from ${RelatedClass}ID to "ChildID". | ||
* | ||
* {@see SilverStripe\ORM\DataObjectSchema->parseManyManyComponent()} | ||
* | ||
* @var array | ||
* @config | ||
*/ | ||
private static $has_one = [ | ||
'BasePage' => BasePage::class, | ||
'Child' => BasePage::class, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters