Implement export types

modifié:         core/lib/Thelia/Controller/Admin/ImportExportController.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/Formatter/JsonFormatter.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/Formatter/XMLFormatter.php
	modifié:         core/lib/Thelia/Core/Template/Loop/Formatter.php
	modifié:         core/lib/Thelia/ImportExport/Export/MailingExport.php
	modifié:         core/lib/Thelia/Model/Export.php
	modifié:         templates/backOffice/default/export-page.html
	modifié:         templates/backOffice/default/includes/export-form-definition.html
This commit is contained in:
Benjamin Perche
2014-07-11 10:46:16 +02:00
parent 6bc3ed214b
commit 33695a7886
8 changed files with 157 additions and 117 deletions

View File

@@ -4,6 +4,7 @@ namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Core\Translation\Translator;
use Thelia\ImportExport\ExportHandlerInterface;
use Thelia\Model\Base\Export as BaseExport;
use Thelia\Model\Map\ExportTableMap;
@@ -83,24 +84,32 @@ class Export extends BaseExport
{
$class = $this->getHandleClass();
if ($class[0] !== "\\") {
$class = "\\" . $class;
}
if (!class_exists($class)) {
throw new \ErrorException(
"The class \"%class\" doesn't exist",
[
"%class" => $class
]
Translator::getInstance()->trans(
"The class \"%class\" doesn't exist",
[
"%class" => $class
]
)
);
}
$instance = new $class($container);
if (!$class instanceof ExportHandlerInterface) {
if (!$instance instanceof ExportHandlerInterface) {
throw new \ErrorException(
"The class \"%class\" must implement %interface",
[
"%class" => $class,
"%interface" => "\\Thelia\\ImportExport\\ExportHandlerInterface",
]
Translator::getInstance()->trans(
"The class \"%class\" must implement %interface",
[
"%class" => $class,
"%interface" => "\\Thelia\\ImportExport\\ExportHandlerInterface",
]
)
);
}