Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Where, How And When With Events

$
0
0
Hi Guys,
I am very confused about this events feature in Yii. I understand its similar to Drupal’s Hook system. In a sense i can call different sections of code when an event occurs. EG i update a product in a database, then I tell my application that onProductUpdate has happened. Then from different modules and other areas of my code i could call different functions that can add to this.
I just cant seem to get my head around getting it working and where to put the code. The only way i can seem to get it working is if i have the event call handlers in the innit function where the event is raised, i don’t see how this can benefit if somebody else creates an add-on module they would have to edit the original init function.
I must be reading something wrong here! I have read books and almost everything online! There doesn't seem to be a very good tutorial to get me started!

My situation is as follows:

I have a products, when this product has been sent I raise an event. From there in the future when I add a stock system to the app I want to just add a module that changes the stock level when this event occurs without editing the original code.

Thanks in advanced and I hope someone can help!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>