Diem uses the Symfony Event Dispatcher intensively.
This allows services to be decoupled. This allows you to alter the way they work without extend them.
See the symfony documentation about how to use events
A good place to listen events is the application configuration class :
require_once(dm::getDir().'/dmFrontPlugin/lib/config/dmFrontApplicationConfiguration.php'); class frontConfiguration extends dmFrontApplicationConfiguration { public function configure() { // Register our listeners $this->dispatcher->connect('dm.refresh', array($this, 'listenToRefreshEvent')); } public function listenToRefreshEvent(sfEvent $e) { // do something when project has been successfully refreshed } }
Core events are notified in both admin and front applications.
fired by dmContext when it's fully loaded with a ready to go serviceContainer
parameters: none
fired by dmContext when application has been successfully executed
parameters: none
fired by dmBrowser when it is unable to configure itself from user agent because it is unknown
parameters: the user agent string
fired by dmDoctrineRecord when it will be saved or deleted
parameters: array('type' => create|update|delete)
fired by dmCoreActions when user refreshed the site.
parameters: none
fired by dmCacheCleaner when all cache has been cleared
parameters: array(success => wether the cache has been cleared successfully )
fired by dmCacheCleaner when template cache has been cleared
parameters: none
fired by dmServiceContainerLoaderConfiguration when the service container has been configured, before it is dumped to php
parameters: array(container => the service container, config => array key=>value config from dmConfig)
fired by dmDataTask before loading data
parameters: none
fired by dmDataService after loading data
parameters: none
Admin events are only notified in admin application.
fired by dmAdminMenu when it has been loaded. With this event you can modify the menu array.
parameters: none
value: array the loaded menu
fired by dmAdminBreadcrumb before rendering links. With this event you can modify breadCrumb links just before rendering.
parameters: none
value: array of linkType => options
fired by dmSearchIndex when index has been written to disk
parameters: array(name => index name, nb_documents => number of documents generated, time => population time in seconds)
fired by dmSitemap when sitemap has been written to disk
parameters: array(file => full server path, url => full web path)
fired by static dmConfig when a value has been changed
parameters: array(setting => DmSetting record, culture => culture value)
fired by an admin module edit action when a record will be edited or updated
parameters: array(object => dmDoctrineRecord instance)
Front events are only notified in front application.
fired by dmCoreLayoutHelper before rendering stylesheets. With this event you can modify stylesheets just before rendering.
parameters: none
value: array of stylesheets => options
fired by dmCoreLayoutHelper before rendering javascripts. With this event you can modify javascripts just before rendering.
parameters: none
value: array of javascripts => options
fired by dmCoreLayoutHelper before rendering metas. With this event you can modify metas just before rendering.
parameters: none
value: array of name => value
fired by dmTheme when it has finished creating its filesystem structure
parameters: none
fired by dmFrontContext when current page has changed
parameters: array('page' => DmPage record)
fired by dmWidgetNavigationBreadcrumb before rendering page links. With this event you can modify breadCrumb pages.
parameters: none
value: array of module.action => DmPage record
fired by dmPageNotFoundHandler with a notifyUntil before searching for a possible redirection.
Assign an url to the event's return value to redirect the request.
parameters: array(slug => the not found slug)
fired by dmPageNotFoundHandler with a notifyUntil after searching for a possible redirection, and found nothing.
Assign an url to the event's return value to redirect the request.
parameters: array(slug => the not found slug)
Questions and Feedback
If you need support or have a technical question, you can