refactor rewrriten method name

This commit is contained in:
Manuel Raynaud
2013-09-17 19:11:44 +02:00
parent 232ad70494
commit 60d09dc76e
6 changed files with 76 additions and 20 deletions

View File

@@ -2,8 +2,25 @@
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\RewritingUrl as BaseRewritingUrl;
use Thelia\Model\RewritingUrlQuery;
class RewritingUrl extends BaseRewritingUrl {
public function preSave(ConnectionInterface $con = null)
{
if($this->getRedirected() == 0) {
//check if rewriting url alredy exists and put redirect to 1
RewritingUrlQuery::create()
->filterByView($this->getView())
->filterByViewId($this->getViewId())
->filterByViewLocale($this->getViewLocale())
->update(array(
"redirect" => 1
));
}
return true;
}
}