Boris,

Thank you for your reply. Very helpful.

I'll give it a try.

Jerry

On Monday, March 11, 2013 5:39:01 AM UTC-4, Борислав Събев wrote:
>
> Hey, Jerry.
>
> You could use bootstrap.php for such event attachments.
> What I usually do is to create another file, in the Config folder, called 
> evenmanagement.php for example, and include it at the end of bootstrap.php.
> This way all my events-subscribers etc. logic is in one file.
>
> You could also put it in AppController, but the  method described is 
> somewhat cleaner.
> You could also attach these bindings just for parts of the applications, 
> but you will need to be very careful of what you do.
>
> Borislav.
> On Sunday, 10 March 2013 21:57:47 UTC+2, Jerry Kita wrote:
>>
>> Hi,
>>
>> I'm somewhat new to CakePHP but working to get up to speed quickly.
>>
>> I'm trying to understand the Events Systems. I've been able to successful 
>> create events, define listeners, attach listeners and receive event objects 
>> .... all within the same Model-Controller-Class. It works well and I've 
>> managed to get comfortable with it. I've create a ProductsController and 
>> within that class everything works well. 
>>
>> What I would like to do is define an event in Model-Controller-Class 'A'  
>> (Product) and create a listener in Model-Controller-Class 'B' (Order). The 
>> net effect would be that an event object is created as a result of some 
>> action within 'A' and that event object is passed to 'B'. 'A' to 'A' or 'B' 
>> to 'B' I can manage.
>>
>> I've read about the Global Event Manager and that would seem to be the 
>> ticket. However, the documentation doesn't provide a newcomer like me 
>> sufficient depth to get it right. The documentation suggests the following:
>>
>> // In any configuration file or piece of code that executes before the 
>> eventApp::uses('CakeEventManager', 
>> 'Event');CakeEventManager::instance()->attach($aCallback, 
>> 'Model.Order.beforePlace');
>>
>> So what configuration file or piece of code is recommended? AppController? 
>> And where does the function go? In the same file? As you can see
>> the answer is not obvious enough to me to figure it out and I can't find any 
>> examples on the internet.
>>
>> Any suggestions of links or tutorials or hints would be appreciated. If I've 
>> not provided enough enough information I'm happy to provide
>> that too!
>>
>> Thanks, Jerry
>>
>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to