-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relations): Connect elements with a many_many "through" relation…
… [WIP]
- Loading branch information
Marco Crespi
committed
Feb 22, 2018
1 parent
067e409
commit 76dfc5c
Showing
7 changed files
with
106 additions
and
43 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,19 @@ | ||
<?php | ||
|
||
namespace FlxLabs\PageSections; | ||
|
||
use SilverStripe\ORM\DataObject; | ||
|
||
class PageElementSelfRel extends DataObject { | ||
|
||
private static $table_name = "FLXLabs_PageElementSelfRel"; | ||
|
||
private static $db = array( | ||
"SortOrder" => "Int", | ||
); | ||
|
||
private static $has_one = array( | ||
"Parent" => PageElement::class, | ||
"Child" => PageElement::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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace FlxLabs\PageSections; | ||
|
||
use SilverStripe\CMS\Model\SiteTree; | ||
use SilverStripe\ORM\DataObject; | ||
|
||
class PageSectionPageElementRel extends DataObject { | ||
|
||
private static $table_name = "FLXLabs_PageSectionPageElementRel"; | ||
|
||
private static $db = array( | ||
"SortOrder" => "Int", | ||
); | ||
|
||
private static $has_one = array( | ||
"PageSection" => "Page", | ||
"Element" => PageElement::class, | ||
); | ||
|
||
|
||
public function onBeforeWrite() { | ||
parent::onBeforeWrite(); | ||
|
||
if (!$this->ID && !$this->SortOrder) { | ||
$this->SortOrder = 1337; | ||
} | ||
} | ||
} |
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