Aded feature_template and category_template position management
This commit is contained in:
@@ -3,8 +3,30 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\FeatureTemplate as BaseFeatureTemplate;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
|
||||
class FeatureTemplate extends BaseFeatureTemplate
|
||||
class FeatureTemplate extends BaseFeatureTemplate
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* Calculate next position relative to our template
|
||||
*/
|
||||
protected function addCriteriaToPositionQuery($query)
|
||||
{
|
||||
$query->filterByTemplateId($this->getTemplateId());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
// Set the current position for the new object
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user