Merge pull request #332 from bilhackmac/master
Load modules by position
This commit is contained in:
@@ -27,7 +27,7 @@ class BaseAction
|
|||||||
* @param ModelCriteria $query
|
* @param ModelCriteria $query
|
||||||
* @param UpdatePositionEvent $event
|
* @param UpdatePositionEvent $event
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return null
|
||||||
*/
|
*/
|
||||||
protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event)
|
protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -180,6 +180,8 @@ class Module extends BaseAction implements EventSubscriberInterface
|
|||||||
public function updatePosition(UpdatePositionEvent $event)
|
public function updatePosition(UpdatePositionEvent $event)
|
||||||
{
|
{
|
||||||
$this->genericUpdatePosition(ModuleQuery::create(), $event);
|
$this->genericUpdatePosition(ModuleQuery::create(), $event);
|
||||||
|
|
||||||
|
$this->cacheClear($event->getDispatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function cacheClear(EventDispatcherInterface $dispatcher)
|
protected function cacheClear(EventDispatcherInterface $dispatcher)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class ModuleQuery extends BaseModuleQuery
|
|||||||
if (null === self::$activated) {
|
if (null === self::$activated) {
|
||||||
self::$activated = self::create()
|
self::$activated = self::create()
|
||||||
->filterByActivate(1)
|
->filterByActivate(1)
|
||||||
|
->orderByPosition()
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -728,6 +728,9 @@
|
|||||||
<column name="chapo" type="LONGVARCHAR" />
|
<column name="chapo" type="LONGVARCHAR" />
|
||||||
<column name="postscriptum" type="LONGVARCHAR" />
|
<column name="postscriptum" type="LONGVARCHAR" />
|
||||||
<column name="full_namespace" size="255" type="VARCHAR" />
|
<column name="full_namespace" size="255" type="VARCHAR" />
|
||||||
|
<index name="idx_module_activate">
|
||||||
|
<index-column name="activate" />
|
||||||
|
</index>
|
||||||
<unique name="code_UNIQUE">
|
<unique name="code_UNIQUE">
|
||||||
<unique-column name="code" />
|
<unique-column name="code" />
|
||||||
</unique>
|
</unique>
|
||||||
|
|||||||
@@ -866,7 +866,8 @@ CREATE TABLE `module`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `code_UNIQUE` (`code`)
|
UNIQUE INDEX `code_UNIQUE` (`code`),
|
||||||
|
INDEX `idx_module_activate` (`activate`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB CHARACTER SET='utf8';
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
|||||||
12
setup/update/2.0.1.sql
Normal file
12
setup/update/2.0.1.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||||
|
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
UPDATE `config` SET `value`='2.0.1' WHERE `name`='thelia_version';
|
||||||
|
UPDATE `config` SET `value`='' WHERE `name`='thelia_extra_version';
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `module` ADD INDEX `idx_module_activate` (`activate`);
|
||||||
|
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
Reference in New Issue
Block a user