Can you explain what it is you’re trying to achieve? That could help us providing you with the right answers. It seems like you’re writing functions only to call parent functions, that shouldn’t be the goal in the first place .
Hmm… I thought it was self evident what I was trying to do. So I will start from the beginning. I created a few nice set of functions to be used in my controller actions for some purpose. Then I thought about grouping them together into a class because they were all dependent on each other. A class object gives more flexibility too. But I did in the spirit of a Yii component, e.g. using setters and getters, behaviors, and events. And I researched a little, but when putting it all together, I came across some crazy ideas.
Based on the tutorials I was reading online, I concluded that every component has event property(ies) that begin(s) with on*. In order to initiate attached events, you would use $this->raiseEvent(‘on*’,$event) anywhere in your code you want to initiate events. But every tutorial says to create a separate function named on* that calls on $this->raiseEvent(‘on*’,$event) for flexibility in executing other code before/after raiseEvent(). The crazy idea was to create a universal event caller using __call() that filtered out functions beginning with on* and executed raiseEvent method as a result.
So if I called $this->raiseEvent(), it worked. If I wrapped it in separate function and called that like $this->on*, it worked. If I used __call() to dynamically answer all functions beginning with on*, it gave me an error if the event was not defined. I looked at the code for raiseEvent() and indeed there is a throw Exception for this purpose, but it only gets executed under my crazy idea.
Edit: looking back at your question, that seems to be what I am doing. Regardless of right or wrong, why is an Exception thrown if the parent function is called from __call()?
So the answer is yes: Each RaiseEvent has to be wrapped in a function with that name and they cannot be dynamically created on the fly.
The reason for this is the hasEvent property and getEventHandlers require a method explicitly defined within the component to check if the event is valid enough for handlers to be added.
To create virtual Events that are not explicitly defined will break the purpose of hasEvent.