Skip to content

Commit

Permalink
Merge pull request #17 from Lurivar/rewrittenUrlFix
Browse files Browse the repository at this point in the history
Fixed rewritten urls not marked as obsolete on deletion
  • Loading branch information
lopes-vincent authored Sep 23, 2019
2 parents 241fc74 + 6a3d4df commit baf7b9d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Action/SelectionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use Thelia\Core\Event\UpdatePositionEvent;
use Selection\Model\Base\SelectionProductQuery;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery;
use Thelia\Model\RewritingUrlQuery;

class SelectionAction extends BaseAction implements EventSubscriberInterface
{
Expand Down Expand Up @@ -60,13 +62,29 @@ public function updateSeo(
return $this->genericUpdateSeo(SelectionQuery::create(), $event, $dispatcher);
}

/**
* {@inheritDoc}
*/
public function getRewrittenUrlViewName()
{
return 'selection';
}

/**
* @param SelectionEvent $event
* @throws \Propel\Runtime\Exception\PropelException
*/
public function delete(SelectionEvent $event)
{
$this->getSelection($event)->delete();

RewritingUrlQuery::create()
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($event->getId())
->update(array(
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));

}

protected function getSelection(SelectionEvent $event)
Expand Down
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.6</version>
<version>1.1.7</version>
<authors>
<author>
<name>Maxime BRUCHET</name>
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This module allows you to create a selection of products or contents of similar
of those products or contents.

## Compatibility
* To use this module on Thelia 2.3.x, use the tag 1.1.2
* To use this module on Thelia 2.3.x, use the tag 1.1.7

## Installation

Expand All @@ -19,7 +19,7 @@ of those products or contents.
Add it in your main thelia composer.json file

```
composer require thelia/selection-module:~1.1.2
composer require thelia/selection-module:~1.1.7
```

## Usage
Expand Down

0 comments on commit baf7b9d

Please sign in to comment.