Merge pull request #332 from bilhackmac/master

Load modules by position
This commit is contained in:
Manuel Raynaud
2014-04-24 10:37:18 +02:00
6 changed files with 21 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ class BaseAction
* @param ModelCriteria $query
* @param UpdatePositionEvent $event
*
* @return mixed
* @return null
*/
protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event)
{

View File

@@ -180,6 +180,8 @@ class Module extends BaseAction implements EventSubscriberInterface
public function updatePosition(UpdatePositionEvent $event)
{
$this->genericUpdatePosition(ModuleQuery::create(), $event);
$this->cacheClear($event->getDispatcher());
}
protected function cacheClear(EventDispatcherInterface $dispatcher)

View File

@@ -25,6 +25,7 @@ class ModuleQuery extends BaseModuleQuery
if (null === self::$activated) {
self::$activated = self::create()
->filterByActivate(1)
->orderByPosition()
->find();
}

View File

@@ -728,6 +728,9 @@
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="full_namespace" size="255" type="VARCHAR" />
<index name="idx_module_activate">
<index-column name="activate" />
</index>
<unique name="code_UNIQUE">
<unique-column name="code" />
</unique>

View File

@@ -866,7 +866,8 @@ CREATE TABLE `module`
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
UNIQUE INDEX `code_UNIQUE` (`code`)
UNIQUE INDEX `code_UNIQUE` (`code`),
INDEX `idx_module_activate` (`activate`)
) ENGINE=InnoDB CHARACTER SET='utf8';
-- ---------------------------------------------------------------------

12
setup/update/2.0.1.sql Normal file
View 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;