diff --git a/.upgrade.yml b/.upgrade.yml new file mode 100644 index 0000000..aefba0a --- /dev/null +++ b/.upgrade.yml @@ -0,0 +1,8 @@ +mappings: + UserFormUseQueuedExportExtension: SilverStripe\GridfieldQueuedExport\Extensions\UserFormUseQueuedExportExtension + GenerateCSVJob: SilverStripe\GridfieldQueuedExport\Jobs\GenerateCSVJob + GridFieldQueuedExportButton: SilverStripe\GridfieldQueuedExport\Forms\GridFieldQueuedExportButton + GridFieldQueuedExportButton_Response: SilverStripe\GridfieldQueuedExport\Forms\GridFieldQueuedExportButtonResponse + GenerateCSVJobTest: SilverStripe\GridFieldQueuedExport\Tests\GenerateCSVJobTest + GenerateCSVJobTest_Record: SilverStripe\GridFieldQueuedExport\Tests\GenerateCSVJobTestRecord + GenerateCSVJobTest_Controller: SilverStripe\GridFieldQueuedExport\Tests\GenerateCSVJobTestController diff --git a/src/Extensions/UserFormUseQueuedExportExtension.php b/src/Extensions/UserFormUseQueuedExportExtension.php index f9d3746..22246ac 100644 --- a/src/Extensions/UserFormUseQueuedExportExtension.php +++ b/src/Extensions/UserFormUseQueuedExportExtension.php @@ -12,7 +12,7 @@ */ class UserFormUseQueuedExportExtension extends DataExtension { - function updateCMSFields(FieldList $fields) + public function updateCMSFields(FieldList $fields) { $gridField = $fields->fieldByName('Root.Submissions.Submissions'); diff --git a/src/GridFieldQueuedExportButton.php b/src/Forms/GridFieldQueuedExportButton.php similarity index 97% rename from src/GridFieldQueuedExportButton.php rename to src/Forms/GridFieldQueuedExportButton.php index f254dce..18aa665 100644 --- a/src/GridFieldQueuedExportButton.php +++ b/src/Forms/GridFieldQueuedExportButton.php @@ -1,6 +1,6 @@ startExport($gridField); } elseif ($actionName == 'findgridfield') { - return new GridFieldQueuedExportButton_Response($gridField); + return new GridFieldQueuedExportButtonResponse($gridField); } } - function startExport($gridField) + public function startExport($gridField) { $job = new GenerateCSVJob(); diff --git a/src/GridFieldQueuedExportButton_Response.php b/src/Forms/GridFieldQueuedExportButtonResponse.php similarity index 81% rename from src/GridFieldQueuedExportButton_Response.php rename to src/Forms/GridFieldQueuedExportButtonResponse.php index 477287e..6249236 100644 --- a/src/GridFieldQueuedExportButton_Response.php +++ b/src/Forms/GridFieldQueuedExportButtonResponse.php @@ -1,6 +1,6 @@ GridFieldName = $gridField->getName(); $this->GridFieldURL = $gridField->Link(); @@ -75,7 +77,7 @@ function setGridField(GridField $gridField) /** * @param $session */ - function setSession($session) + public function setSession($session) { // None of the gridfield actions are needed, and they make the stored session bigger, so pull // them out. @@ -91,17 +93,17 @@ function setSession($session) $this->Session = $session; } - function setColumns($columns) + public function setColumns($columns) { $this->Columns = $columns; } - function setSeparator($seperator) + public function setSeparator($seperator) { $this->Separator = $seperator; } - function setIncludeHeader($includeHeader) + public function setIncludeHeader($includeHeader) { $this->IncludeHeader = $includeHeader; } @@ -169,7 +171,7 @@ protected function getGridField() $res = Director::test($url, null, new Session($session), 'GET'); // Great, it did, we can return it - if ($res instanceof GridFieldQueuedExportButton_Response) { + if ($res instanceof GridFieldQueuedExportButtonResponse) { $gridField = $res->getGridField(); $gridField->getConfig()->removeComponentsByType(GridFieldPaginator::class); $gridField->getConfig()->removeComponentsByType(GridFieldPageCount::class); diff --git a/tests/GenerateCSVJobTest.php b/tests/GenerateCSVJobTest.php index 3fe84e5..092ba89 100644 --- a/tests/GenerateCSVJobTest.php +++ b/tests/GenerateCSVJobTest.php @@ -1,25 +1,26 @@ update(Director::class, 'rules', array( - 'jobtest//$Action/$ID/$OtherID' => GenerateCSVJobTest_Controller::class + 'jobtest//$Action/$ID/$OtherID' => GenerateCSVJobTestController::class )); } @@ -40,7 +41,7 @@ public function testGenerateExport() $session = array('loggedInAs' => $memberID); // Build controller - $controller = new GenerateCSVJobTest_Controller(); + $controller = new GenerateCSVJobTestController(); $form = $controller->Form(); $gridfield = $form->Fields()->fieldByName('MyGridfield'); @@ -83,4 +84,3 @@ protected function createJob($gridField, $session) return $job; } } - diff --git a/tests/GenerateCSVJobTest_Controller.php b/tests/GenerateCSVJobTestController.php similarity index 78% rename from tests/GenerateCSVJobTest_Controller.php rename to tests/GenerateCSVJobTestController.php index bae6816..73d1d38 100644 --- a/tests/GenerateCSVJobTest_Controller.php +++ b/tests/GenerateCSVJobTestController.php @@ -1,7 +1,6 @@