Event Observer – How to Pass Data Through XML

event-observer

I have to implement some functionality that requires different observers to "observe" different events. No problem here.
All the actions performed by these observers are basically the same, they just depend on a key (string). Let's call it 'something'.
What I've done so far, is to create a "parent" observer (abstract) and have child classes that extend the abstract observer and just implement a method:

public function getSomething(){
    return 'some_value';
}

In the abstract observer I have a method:

public function doSomeAction($observer){
   $something = $this->getSomething();
   //do magic with $something.
}

What I want to achieve, for extensibility reasons is to be able to pass to the event through config.xml this key so I won't need a new observer class and just be able to call the abstract observer (that is not going to be abstract anymore) with that parameter.
Something like:

<some_event_name>
    <observers>
        <unique_observer_key>
            <type>singleton</type>
            <class>my/observer</class>
            <method>doSomeAction</method>
            <something>some_value</something><!-- need to pass this -->
        </unique_observer_key>
    <observers>
</some_event_name>

[Edit]
I found that you can pass some arguments in the event xml like this:

<some_event_name>
    <observers>
        <unique_observer_key>
            <type>singleton</type>
            <class>my/observer</class>
            <method>doSomeAction</method>
            <args>
                <something>some_value</something>
            </args>
        </unique_observer_key>
    <observers>
</some_event_name>

I deleted the question after finding this. But I undeleted it after further digging because those parameters are USELESS. They are never used or passed to the class instance that handles the event.
Any ideas on how should I tackle this?

Best Answer

After digging I found out that what I want is not possible without rewriting the App model.