Finish Import / Export categories management
modifié: core/lib/Thelia/Config/Resources/routing/admin.xml modifié: core/lib/Thelia/Controller/Admin/ExportController.php 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/FileFormat/Formatting/FormatterInterface.php modifié: core/lib/Thelia/Core/Template/Loop/Export.php modifié: core/lib/Thelia/Core/Template/Loop/Formatter.php nouveau fichier: core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php nouveau fichier: core/lib/Thelia/ImportExport/Export/ExportType.php nouveau fichier: core/lib/Thelia/ImportExport/Export/MailingExport.php modifié: core/lib/Thelia/ImportExport/ExportHandlerInterface.php modifié: core/lib/Thelia/Model/Export.php modifié: core/lib/Thelia/Model/ExportCategory.php modifié: core/lib/Thelia/Model/ImportCategory.php modifié: templates/backOffice/default/export-page.html modifié: templates/backOffice/default/export.html modifié: templates/backOffice/default/import.html modifié: templates/backOffice/default/includes/export-form-definition.html
This commit is contained in:
@@ -1158,7 +1158,7 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\TranslationsController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<!-- export management -->
|
||||
<!-- import and export management -->
|
||||
|
||||
<route id="export.list" path="/admin/export">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default>
|
||||
@@ -1176,6 +1176,18 @@
|
||||
<requirement key="value">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="export.category.position" path="/admin/export/position/category/{action}/{id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::changeCategoryPosition</default>
|
||||
<requirement key="action">up|down</requirement>
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="export.category.position.update" path="/admin/export/position/category/update/{id}/{value}">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::updateCategoryPosition</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
<requirement key="value">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="export.action" path="/admin/export/{id}" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Admin\ImportExportController::export</default>
|
||||
<requirement key="id">\d+</requirement>
|
||||
|
||||
@@ -16,6 +16,7 @@ use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Template\Loop\ImportExportType;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\ExportCategoryQuery;
|
||||
use Thelia\Model\ExportQuery;
|
||||
|
||||
/**
|
||||
@@ -31,15 +32,7 @@ class ExportController extends BaseAdminController
|
||||
return $response;
|
||||
}
|
||||
|
||||
$export_order = $this->getRequest()->query->get("export_order");
|
||||
|
||||
if (!in_array($export_order, ImportExportType::getAllowedOrders())) {
|
||||
$export_order = ImportExportType::DEFAULT_ORDER;
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", $export_order)
|
||||
;
|
||||
$this->setOrders();
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
@@ -58,9 +51,7 @@ class ExportController extends BaseAdminController
|
||||
$export->downPosition();
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", "manual")
|
||||
;
|
||||
$this->setOrders(null, "manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
@@ -75,13 +66,63 @@ class ExportController extends BaseAdminController
|
||||
|
||||
$export->updatePosition($value);
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", "manual")
|
||||
;
|
||||
$this->setOrders(null, "manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
|
||||
public function changeCategoryPosition($action, $id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::UPDATE])) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$category = $this->getCategory($id);
|
||||
|
||||
if ($action === "up") {
|
||||
$category->upPosition();
|
||||
} elseif ($action === "down") {
|
||||
$category->downPosition();
|
||||
}
|
||||
|
||||
$this->setOrders("manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
|
||||
public function updateCategoryPosition($id, $value)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::UPDATE])) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$category = $this->getCategory($id);
|
||||
|
||||
$category->updatePosition($value);
|
||||
|
||||
$this->setOrders("manual");
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
|
||||
protected function setOrders($category = null, $export = null)
|
||||
{
|
||||
if ($category === null) {
|
||||
$category = $this->getRequest()->query->get("category_order");
|
||||
}
|
||||
|
||||
if ($export === null) {
|
||||
$export = $this->getRequest()->query->get("export_order");
|
||||
}
|
||||
|
||||
$this->getParserContext()
|
||||
->set("category_order", $category)
|
||||
;
|
||||
|
||||
$this->getParserContext()
|
||||
->set("export_order", $export)
|
||||
;
|
||||
}
|
||||
|
||||
protected function getExport($id)
|
||||
{
|
||||
@@ -99,4 +140,21 @@ class ExportController extends BaseAdminController
|
||||
}
|
||||
return $export;
|
||||
}
|
||||
|
||||
protected function getCategory($id)
|
||||
{
|
||||
$category = ExportCategoryQuery::create()->findPk($id);
|
||||
|
||||
if (null === $category) {
|
||||
throw new \ErrorException(
|
||||
Translator::getInstance()->trans(
|
||||
"There is no id \"%id\" in the export categories",
|
||||
[
|
||||
"%id" => $id
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Model\ExportQuery;
|
||||
|
||||
/**
|
||||
* Class ImportExportController
|
||||
@@ -20,23 +21,40 @@ use Thelia\Core\HttpFoundation\Response;
|
||||
*/
|
||||
class ImportExportController extends BaseAdminController
|
||||
{
|
||||
public function import()
|
||||
public function import($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
public function export($id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function importView()
|
||||
public function importView($id)
|
||||
{
|
||||
if (null === $export = $this->getExport($id)) {
|
||||
return $this->render("404");
|
||||
}
|
||||
|
||||
return $this->render("import-page");
|
||||
}
|
||||
|
||||
public function exportView()
|
||||
public function exportView($id)
|
||||
{
|
||||
if (null === $export = $this->getExport($id)) {
|
||||
return $this->render("404");
|
||||
}
|
||||
|
||||
return $this->render("export-page");
|
||||
}
|
||||
|
||||
protected function getExport($id)
|
||||
{
|
||||
$export = ExportQuery::create()
|
||||
->findPk($id)
|
||||
;
|
||||
|
||||
return $export;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
namespace Thelia\Core\FileFormat\Formatting\Formatter;
|
||||
use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\Export\ExportType;
|
||||
|
||||
/**
|
||||
* Class JsonFormatter
|
||||
@@ -87,4 +88,11 @@ class JsonFormatter extends AbstractFormatter
|
||||
);
|
||||
}
|
||||
|
||||
public function getExportType()
|
||||
{
|
||||
return array(
|
||||
ExportType::EXPORT_TABLE,
|
||||
ExportType::EXPORT_UNBOUNDED,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace Thelia\Core\FileFormat\Formatting\Formatter;
|
||||
use Thelia\Core\FileFormat\Formatter\Exception\BadFormattedStringException;
|
||||
use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\Export\ExportType;
|
||||
|
||||
/**
|
||||
* Class XMLFormatter
|
||||
@@ -141,4 +142,12 @@ class XMLFormatter extends AbstractFormatter
|
||||
$data = new FormatterData($this->getAliases());
|
||||
return $data->setData($array);
|
||||
}
|
||||
|
||||
public function getExportType()
|
||||
{
|
||||
return array(
|
||||
ExportType::EXPORT_TABLE,
|
||||
ExportType::EXPORT_UNBOUNDED,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,4 +36,17 @@ interface FormatterInterface
|
||||
* a FormatterData object.
|
||||
*/
|
||||
public function decode($rawData);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* return a string that defines the handled format type.
|
||||
*
|
||||
* Thelia types are defined in \Thelia\ImportExport\Export\ExportType
|
||||
*
|
||||
* examples:
|
||||
* return ExportType::EXPORT_TABLE;
|
||||
* return ExportType::EXPORT_UNBOUNDED;
|
||||
*/
|
||||
public function getExportType();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
use Thelia\Model\ExportQuery;
|
||||
use Thelia\Model\Map\ExportTableMap;
|
||||
|
||||
/**
|
||||
* Class Export
|
||||
|
||||
@@ -17,6 +17,7 @@ use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\ExportQuery;
|
||||
use Thelia\Type\EnumType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
@@ -39,19 +40,27 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
|
||||
|
||||
$rawFormatters = array_change_key_case($service->getAll());
|
||||
|
||||
$allowedFormatter = $this->getAllowed_formatter();
|
||||
$exportId = $this->getExport();
|
||||
$formatters = [];
|
||||
if ($allowedFormatter !== null) {
|
||||
$allowedFormatter = explode(",", $allowedFormatter);
|
||||
if ($exportId !== null) {
|
||||
$export = ExportQuery::create()->findPk($exportId);
|
||||
|
||||
if (null !== $export) {
|
||||
$types = $export->getHandleClassInstance($this->container)
|
||||
->getHandledType();
|
||||
|
||||
foreach($allowedFormatter as $formatter) {
|
||||
$formatter = trim(strtolower($formatter));
|
||||
if (is_scalar($types)) {
|
||||
$types = [$types];
|
||||
}
|
||||
|
||||
if (isset($rawFormatters[$formatter])) {
|
||||
$formatters[$formatter] = $rawFormatters[$formatter];
|
||||
/** @var \Thelia\Core\FileFormat\Formatting\AbstractFormatter $formatter */
|
||||
foreach ($rawFormatters as $key=>$formatter) {
|
||||
if (in_array($formatter->getExportType(), $types)) {
|
||||
$formatters[$key] = $formatter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$formatters = $rawFormatters;
|
||||
}
|
||||
@@ -118,7 +127,7 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createAnyTypeArgument("allowed_formatter"),
|
||||
Argument::createIntTypeArgument("export"),
|
||||
new Argument(
|
||||
"order",
|
||||
new TypeCollection(
|
||||
|
||||
58
core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php
Normal file
58
core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Both;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\ExportHandlerInterface;
|
||||
use Thelia\ImportExport\ImportHandlerInterface;
|
||||
|
||||
/**
|
||||
* Class NewsletterImportExport
|
||||
* @package Thelia\ImportExport\Both
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class NewsletterImportExport implements ExportHandlerInterface, ImportHandlerInterface
|
||||
{
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*
|
||||
* Dependency injection: load the container to be able to get parameters and services
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds
|
||||
*/
|
||||
public function buildFormatterData()
|
||||
{
|
||||
// TODO: Implement buildFormatterData() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds
|
||||
*/
|
||||
public function importFromFormatterData(FormatterData $data)
|
||||
{
|
||||
// TODO: Implement importFromFormatterData() method.
|
||||
}
|
||||
|
||||
}
|
||||
33
core/lib/Thelia/ImportExport/Export/ExportType.php
Normal file
33
core/lib/Thelia/ImportExport/Export/ExportType.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Export;
|
||||
|
||||
/**
|
||||
* Class ExportType
|
||||
* @package Thelia\ImportExport\Export
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class ExportType
|
||||
{
|
||||
/**
|
||||
* This type is for unbounded formats, in general serialization formats
|
||||
* example: XML, json, yaml
|
||||
*/
|
||||
const EXPORT_UNBOUNDED = "export.unbounded";
|
||||
|
||||
/**
|
||||
* This type is for tabled format ( matrix ), most used by spreadsheet application.
|
||||
* example: CSV, ODS, XLS
|
||||
*/
|
||||
const EXPORT_TABLE = "export.table";
|
||||
}
|
||||
47
core/lib/Thelia/ImportExport/Export/MailingExport.php
Normal file
47
core/lib/Thelia/ImportExport/Export/MailingExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\ImportExport\Export;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||
use Thelia\ImportExport\ExportHandlerInterface;
|
||||
|
||||
/**
|
||||
* Class MailingExport
|
||||
* @package Thelia\ImportExport\Export
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class MailingExport implements ExportHandlerInterface
|
||||
{
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*
|
||||
* Dependency injection: load the container to be able to get parameters and services
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||
*
|
||||
* The method builds
|
||||
*/
|
||||
public function buildFormatterData()
|
||||
{
|
||||
$data = new FormatterData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,4 +33,21 @@ interface ExportHandlerInterface
|
||||
* The method builds
|
||||
*/
|
||||
public function buildFormatterData();
|
||||
|
||||
/**
|
||||
* @return string|array
|
||||
*
|
||||
* Define all the type of export/formatters that this can handle
|
||||
* return a string if it handle a single type ( specific exports ),
|
||||
* or an array if multiple.
|
||||
*
|
||||
* Thelia types are defined in \Thelia\ImportExport\Export\ExportType
|
||||
*
|
||||
* example:
|
||||
* return array(
|
||||
* ExportType::EXPORT_TABLE,
|
||||
* ExportType::EXPORT_UNBOUNDED,
|
||||
* );
|
||||
*/
|
||||
public function getHandledType();
|
||||
}
|
||||
@@ -74,6 +74,11 @@ class Export extends BaseExport
|
||||
$this->setPosition($position)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
* @return ExportHandlerInterface
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public function getHandleClassInstance(ContainerInterface $container)
|
||||
{
|
||||
$class = $this->getHandleClass();
|
||||
|
||||
@@ -2,9 +2,73 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Model\Base\CategoryQuery;
|
||||
use Thelia\Model\Base\ExportCategory as BaseExportCategory;
|
||||
use Thelia\Model\Map\ExportCategoryTableMap;
|
||||
|
||||
class ExportCategory extends BaseExportCategory
|
||||
{
|
||||
public function upPosition()
|
||||
{
|
||||
if (($position = $this->getPosition()) > 1) {
|
||||
|
||||
}
|
||||
$previous = ExportCategoryQuery::create()
|
||||
->findOneByPosition($position - 1)
|
||||
;
|
||||
|
||||
if (null !== $previous) {
|
||||
$previous->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position - 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function downPosition()
|
||||
{
|
||||
$max = CategoryQuery::create()
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->select(ExportCategoryTableMap::POSITION)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$count = CategoryQuery::create()->count();
|
||||
|
||||
if ($count > $max) {
|
||||
$max = $count;
|
||||
}
|
||||
|
||||
$position = $this->getPosition();
|
||||
|
||||
if ($position < $max) {
|
||||
|
||||
$next = ExportCategoryQuery::create()
|
||||
->findOneByPosition($position + 1)
|
||||
;
|
||||
|
||||
if (null !== $next) {
|
||||
$next->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position + 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updatePosition($position)
|
||||
{
|
||||
$reverse = ExportCategoryQuery::create()
|
||||
->findOneByPosition($position)
|
||||
;
|
||||
|
||||
if (null !== $reverse) {
|
||||
$reverse->setPosition($this->getPosition())->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position)->save();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,72 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Model\Base\ImportCategory as BaseImportCategory;
|
||||
use Thelia\Model\Map\ImportCategoryTableMap;
|
||||
|
||||
class ImportCategory extends BaseImportCategory
|
||||
{
|
||||
public function upPosition()
|
||||
{
|
||||
if (($position = $this->getPosition()) > 1) {
|
||||
|
||||
$previous = ImportCategoryQuery::create()
|
||||
->findOneByPosition($position - 1)
|
||||
;
|
||||
|
||||
if (null !== $previous) {
|
||||
$previous->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position - 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function downPosition()
|
||||
{
|
||||
$max = CategoryQuery::create()
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->select(ImportCategoryTableMap::POSITION)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$count = CategoryQuery::create()->count();
|
||||
|
||||
if ($count > $max) {
|
||||
$max = $count;
|
||||
}
|
||||
|
||||
$position = $this->getPosition();
|
||||
|
||||
if ($position < $max) {
|
||||
|
||||
$next = ImportCategoryQuery::create()
|
||||
->findOneByPosition($position + 1)
|
||||
;
|
||||
|
||||
if (null !== $next) {
|
||||
$next->setPosition($position)->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position + 1)->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updatePosition($position)
|
||||
{
|
||||
$reverse = ImportCategoryQuery::create()
|
||||
->findOneByPosition($position)
|
||||
;
|
||||
|
||||
if (null !== $reverse) {
|
||||
$reverse->setPosition($this->getPosition())->save();
|
||||
}
|
||||
|
||||
$this->setPosition($position)->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user