symphonycms/symphony-2 — Issue #993: Delegate execution order
Author: vlad-ghita
Created: 2012-01-19 08:08:25+00:00
State: open

I'm starting to feel the need for a way to customize the order of delegates callbacks execution order.

For example see [this post](http://symphony-cms.com/discuss/thread/83317/1/#position-4).

Currently the delegates are fetched from Database in order of extension name ([lines 544-528](https://github.com/symphonycms/symphony-2/blob/master/symphony/lib/toolkit/class.extensionmanager.php#L524-527)):

self::$_subscriptions = Symphony::Database()->fetch("
SELECT t1.name, t2.page, t2.delegate, t2.callback
FROM `tbl_extensions` as t1 INNER JOIN `tbl_extensions_delegates` as t2 ON t1.id = t2.extension_id
WHERE t1.status = 'enabled'");

I would suggest a quick way of customizing this by adding `ORDER BY t1.id` to the query. This way, as a developer, I have a quick way of telling Symphony the order of execution by installing extension in desired order.

WHERE t1.status = 'enabled' ORDER BY t1.id ASC");

This won't fill the need for a more elaborate mechanism of execution order at delegate level, but it's a quick fix atm.

Perhaps doable in 2.3?