mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
6b25237ec6
This enhancement adds the ability to add documents to a document set based on a list of filters added from DMSDocument. Fixes #96
46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class StubRelatedDocumentExtension
|
|
*
|
|
* @package dms
|
|
*/
|
|
class StubRelatedDocumentExtension extends DataExtension implements TestOnly
|
|
{
|
|
/**
|
|
* For method {@link DMSDocument::getRelatedDocuments}
|
|
*
|
|
* @param ArrayList $relatedDocuments
|
|
* @return ArrayList
|
|
*/
|
|
public function updateRelatedDocuments($relatedDocuments)
|
|
{
|
|
$relatedDocuments->push($this->getFakeDocument());
|
|
return $relatedDocuments;
|
|
}
|
|
|
|
/**
|
|
* For method {@link DMSDocumentSet::getDocuments}
|
|
*
|
|
* @param ArrayList $relatedDocuments
|
|
* @return ArrayList
|
|
*/
|
|
public function updateDocuments($documents)
|
|
{
|
|
$documents->push($this->getFakeDocument());
|
|
return $documents;
|
|
}
|
|
|
|
/**
|
|
* Return a dummy document for testing purposes
|
|
*
|
|
* @return DMSDocument
|
|
*/
|
|
protected function getFakeDocument()
|
|
{
|
|
$fakeDocument = new DMSDocument;
|
|
$fakeDocument->Filename = 'Extended';
|
|
return $fakeDocument;
|
|
}
|
|
}
|