Clear Container usage in position action and fix slashes adding in CSV formatter
modifié: core/lib/Thelia/Action/Export.php modifié: core/lib/Thelia/Action/Import.php modifié: core/lib/Thelia/Config/Resources/action.xml modifié: core/lib/Thelia/Core/FileFormat/Formatting/Formatter/CSVFormatter.php
This commit is contained in:
@@ -27,14 +27,11 @@ use Thelia\Model\ExportQuery;
|
||||
*/
|
||||
class Export extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
protected $environment;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
public function __construct($environment)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->environment = $environment;
|
||||
}
|
||||
|
||||
public function changeCategoryPosition(UpdatePositionEvent $event)
|
||||
@@ -54,7 +51,7 @@ class Export extends BaseAction implements EventSubscriberInterface
|
||||
protected function cacheClear(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$cacheEvent = new CacheEvent(
|
||||
$this->container->getParameter('kernel.cache_dir')
|
||||
$this->environment
|
||||
);
|
||||
|
||||
$dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent);
|
||||
|
||||
@@ -27,14 +27,11 @@ use Thelia\Model\ImportQuery;
|
||||
*/
|
||||
class Import extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
protected $environment;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
public function __construct($environment)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->environment = $environment;
|
||||
}
|
||||
|
||||
public function changeCategoryPosition(UpdatePositionEvent $event)
|
||||
@@ -54,7 +51,7 @@ class Import extends BaseAction implements EventSubscriberInterface
|
||||
protected function cacheClear(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$cacheEvent = new CacheEvent(
|
||||
$this->container->getParameter('kernel.cache_dir')
|
||||
$this->environment
|
||||
);
|
||||
|
||||
$dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent);
|
||||
|
||||
@@ -165,12 +165,12 @@
|
||||
</service>
|
||||
|
||||
<service id="thelia.export.change_position" class="Thelia\Action\Export">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument>%kernel.cache_dir%</argument>
|
||||
<tag name="kernel.event_subscriber" />
|
||||
</service>
|
||||
|
||||
<service id="thelia.import.change_position" class="Thelia\Action\Import">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument>%kernel.cache_dir%</argument>
|
||||
<tag name="kernel.event_subscriber" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
@@ -138,7 +138,9 @@ class CSVFormatter extends AbstractFormatter
|
||||
$value = serialize($value);
|
||||
}
|
||||
|
||||
return $this->stringDelimiter . addslashes($value) . $this->stringDelimiter . $this->delimiter;
|
||||
$value = str_replace($this->stringDelimiter, "\\" . $this->stringDelimiter, $value);
|
||||
|
||||
return $this->stringDelimiter . $value . $this->stringDelimiter . $this->delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user