-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH Allow extensions to provide triggers (#214)
Feature/trigger in dataextensions
- Loading branch information
1 parent
8fe9f6c
commit 5c0fda7
Showing
4 changed files
with
78 additions
and
1 deletion.
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
15 changes: 15 additions & 0 deletions
15
tests/php/StaticPublisherTest/Model/DataObjectNoTrigger.php
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,15 @@ | ||
<?php | ||
|
||
namespace SilverStripe\StaticPublishQueue\Test\StaticPublisherTest\Model; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
use SilverStripe\ORM\DataObject; | ||
|
||
class DataObjectNoTrigger extends DataObject implements TestOnly | ||
{ | ||
public function AbsoluteLink() | ||
{ | ||
return 'http://example.com/subpage/dataobject-1'; | ||
} | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
tests/php/StaticPublisherTest/Model/ExtensionAddsTrigger.php
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,27 @@ | ||
<?php | ||
|
||
namespace SilverStripe\StaticPublishQueue\Test\StaticPublisherTest\Model; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
use SilverStripe\Core\Extension; | ||
use SilverStripe\StaticPublishQueue\Contract\StaticPublishingTrigger; | ||
use SilverStripe\StaticPublishQueue\Contract\StaticallyPublishable; | ||
|
||
class ExtensionAddsTrigger extends Extension implements StaticallyPublishable, StaticPublishingTrigger, TestOnly | ||
{ | ||
public function urlsToCache() | ||
{ | ||
return [$this->owner->AbsoluteLink() => 0]; | ||
} | ||
|
||
public function objectsToUpdate($context) | ||
{ | ||
return $this->owner; | ||
} | ||
|
||
public function objectsToDelete($context) | ||
{ | ||
return []; | ||
} | ||
} | ||
|