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:
Benjamin Perche
2014-08-04 16:37:29 +02:00
parent 60b599f8c1
commit 573a21e643
4 changed files with 13 additions and 17 deletions

View File

@@ -27,14 +27,11 @@ use Thelia\Model\ExportQuery;
*/ */
class Export extends BaseAction implements EventSubscriberInterface class Export extends BaseAction implements EventSubscriberInterface
{ {
/** protected $environment;
* @var ContainerInterface
*/
protected $container;
public function __construct(ContainerInterface $container) public function __construct($environment)
{ {
$this->container = $container; $this->environment = $environment;
} }
public function changeCategoryPosition(UpdatePositionEvent $event) public function changeCategoryPosition(UpdatePositionEvent $event)
@@ -54,7 +51,7 @@ class Export extends BaseAction implements EventSubscriberInterface
protected function cacheClear(EventDispatcherInterface $dispatcher) protected function cacheClear(EventDispatcherInterface $dispatcher)
{ {
$cacheEvent = new CacheEvent( $cacheEvent = new CacheEvent(
$this->container->getParameter('kernel.cache_dir') $this->environment
); );
$dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent); $dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent);

View File

@@ -27,14 +27,11 @@ use Thelia\Model\ImportQuery;
*/ */
class Import extends BaseAction implements EventSubscriberInterface class Import extends BaseAction implements EventSubscriberInterface
{ {
/** protected $environment;
* @var ContainerInterface
*/
protected $container;
public function __construct(ContainerInterface $container) public function __construct($environment)
{ {
$this->container = $container; $this->environment = $environment;
} }
public function changeCategoryPosition(UpdatePositionEvent $event) public function changeCategoryPosition(UpdatePositionEvent $event)
@@ -54,7 +51,7 @@ class Import extends BaseAction implements EventSubscriberInterface
protected function cacheClear(EventDispatcherInterface $dispatcher) protected function cacheClear(EventDispatcherInterface $dispatcher)
{ {
$cacheEvent = new CacheEvent( $cacheEvent = new CacheEvent(
$this->container->getParameter('kernel.cache_dir') $this->environment
); );
$dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent); $dispatcher->dispatch(TheliaEvents::CACHE_CLEAR, $cacheEvent);

View File

@@ -165,12 +165,12 @@
</service> </service>
<service id="thelia.export.change_position" class="Thelia\Action\Export"> <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" /> <tag name="kernel.event_subscriber" />
</service> </service>
<service id="thelia.import.change_position" class="Thelia\Action\Import"> <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" /> <tag name="kernel.event_subscriber" />
</service> </service>
</services> </services>

View File

@@ -138,7 +138,9 @@ class CSVFormatter extends AbstractFormatter
$value = serialize($value); $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;
} }
/** /**