Skip to content
This repository

Passing args node value to observer object #63

Closed
wants to merge 1 commit into from

3 participants

Drew Hunter Hervé Guétin
Drew Hunter

There is a reference to a config node 'args' in Mage_Core_Model_App dispatchEvent which can be used when declaring observers in config.xml. Unless mistaken, it currently appears to be unused.

It is not clear what the intended use of this node is, and although I suspect not the original intention, but one potential use could be in passing some arguments to an observer.

This is something I noticed a while back and has came up again recently in a question on stackoverflow: http://stackoverflow.com/questions/11898878/using-args-in-magento-observer-declaration

Please see attached commit, which passes the value of the args node along with observer object.

Alternatively, if the args node is not to be used then the reference to it in Mage_Core_Model_App dispatchEvent could be removed to prevent any future confusion.

Hervé Guétin

+1 for this update!

Owner

@drewhunter
Thanks for pointing out this confusing issue. We have inspected it and concluded that this was never intended to be used.
The 'args' key has been deleted as an undocumented and unused feature.

mage2-team closed this October 02, 2012
mage2-team referenced this pull request from a commit October 09, 2012
Update as of 10/09/2012
* Performance Testing Framework improvements:
  * Added ability to specify fixtures per scenario
  * Implemented Magento application cleanup between scenarios
  * Implemented support of PHP scenarios. The framework distinguishes type of the scenario by its extension: `jmx` or `php`
  * Added ability to skip warm-up for a certain scenario
  * JMeter scenarios are run with `jmeter` command instead of `java -jar ApacheJmeter.jar`. It's impossible to specify path to JMeter tool now, it should be accessible from command line as `jmeter`
* Implemented fixture for Performance Tests with 80k products distributed among 200 categories
* Tax rule management UI simplified:
  * Added `Jeditable` jQuery library
  * Added multiselect fields for customer tax class, product tax class and tax rate
  * Added ability to add/edit Tax Rate directly from Tax Rule page
* Simplified product creation workflow:
  * Added product types dropdown to "Add Product" button. Default attribute set is used for product creation
  * "Add Product" button opens form for Simple product with Default attribute set
  * Attribute set can be changed from product creation form
* Implemented auto-generation of product SKU and meta fields. The templates can be configured in `System -> Configuration -> Catalog -> Catalog -> Product Fields Auto-Generation`
* Added ability to unassign system attribute from an attribute set, if it's not "Minimal" one
* Specified UI IDs for base Backend elements. UI ID is represented as HTML "id" attribute intended to identify certain HTML element
* Refactored `Catalog_Model_Product_Indexer_Flat::matchEvent()` method - reduced cyclomatic complexity
* Updated DB structure to make possible to store Themes' and Widgets' layout updates
* Migration to jQuery:
  * Replaced Ajax, Dialog and Template mechanisms with jQuery analogs
  * Added jQuery loader for translation process
  * Migrated Inline-Translator to jQuery
* JavaScript improvements:
  * Implemented `editTrigger` jQuery widget intended to display "Edit" button for elements it is attached to
* Fixes:
  * Incorrect title for "Currency Symbols" page on Backend
  * References to website, store and store view aren't displayed on Backend, if Single Store mode is disabled
  * "Store" column and dropdown are displayed on `System -> Import/Export -> DataFlow-Profiles` page, when Single Store mode is enabled
  * Options are absent for `'tax_class_id'` product attribute
  * No exception/error message is produced, when attempting to commit/rollback asymmetric DB transaction
  * Links are not copied during downloadable product duplication
  * PayPal tab is absent in `System -> Configuration -> Sales` section
  * "Edit" link in wishlist opens Product View page instead of "Configure Product" page
  * Default value for a product attribute is not saved
  * Escaped HTML blocks with `Mage_Core_Helper_Data::jsonEncode`, where necessary
  * Impossible to add new Dataflow profile
  * Impossible to specify default option for new product attribute with "dropdown" type
  * Unable to send the email when creating new invoice/shipment/credit memo
  * "Segmentation Fault" in Integration tests
* GitHub requests:
  * [#36](#36) -- added ability to force set of "Include Tax" option for catalog prices
  * [#63](#63) -- removed obsolete "args" node in event subscribers
  * [#64](#64) -- fixed EAV text attribute validation for "0" value
  * [#72](#72) -- fixed collecting shipping totals for case, when previous invoice value is 0
72f1ee6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 11, 2012
Drew Hunter Passing config args node along to observer object 54f09c1
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  app/code/core/Mage/Core/Model/App.php
2  app/code/core/Mage/Core/Model/App.php
@@ -1306,7 +1306,7 @@ public function dispatchEvent($eventName, $args)
1306 1306
             }
1307 1307
 
1308 1308
             foreach ($events[$eventName]['observers'] as $obsName=>$obs) {
1309  
-                $observer->setData(array('event'=>$event));
  1309
+                $observer->setData(array('event'=>$event, 'args'=>$obs['args']));
1310 1310
                 Magento_Profiler::start('OBSERVER:' . $obsName);
1311 1311
                 switch ($obs['type']) {
1312 1312
                     case 'disabled':
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.