-
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: CMS editor import/export (#197)
* feat: move to service * style: formatting * feat: template import * fix: edit tables
- Loading branch information
Showing
14 changed files
with
395 additions
and
119 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
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
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,37 @@ | ||
<?php | ||
|
||
namespace NotFound\Framework\Services\CmsExchange; | ||
|
||
abstract class AbstractExchangeService | ||
{ | ||
protected bool $debug; | ||
|
||
protected bool $dryRun; | ||
|
||
protected string $exportTypeName; | ||
|
||
abstract public function runImport(): void; | ||
|
||
abstract public function exportRetainIds(): bool; | ||
|
||
abstract public function exportTypeName(): string; | ||
|
||
public function exportTypeNamePlural(): string | ||
{ | ||
return $this->exportTypeName().'s'; | ||
} | ||
|
||
public function import(bool $debug = false, bool $dryRun = false): void | ||
{ | ||
$this->debug = $debug; | ||
$this->dryRun = $dryRun; | ||
$this->runImport(); | ||
} | ||
|
||
protected function debug($text, $force = false) | ||
{ | ||
if ($this->debug || $force) { | ||
printf("\n - %s", $text); | ||
} | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace NotFound\Framework\Services\CmsExchange; | ||
|
||
class ExchangeConsoleService | ||
{ | ||
public function __construct( | ||
private bool $debug = false, | ||
private bool $dryRun = false | ||
) { | ||
} | ||
|
||
public function import(): void | ||
{ | ||
$this->debug('Starting CMS Import'); | ||
if ($this->dryRun) { | ||
$this->debug('Dry Run: true', force: true); | ||
} | ||
|
||
$tableExchangeService = new TableExchangeService(); | ||
$tableExchangeService->import($this->debug, $this->dryRun); | ||
$templateExchangeService = new TemplateExchangeService(); | ||
$templateExchangeService->import($this->debug, $this->dryRun); | ||
|
||
$this->debug('DONE'); | ||
} | ||
|
||
private function debug($text, $force = false) | ||
{ | ||
if ($this->debug || $force) { | ||
printf("\n - %s", $text); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.