Tuesday, February 17, 2015

Re: Cake Architecture

Seems like an EventHandler is one way to decouple this. The docs (http://book.cakephp.org/3.0/en/core-libraries/events.html) don't seem have a recommended location for this. I'd probably create a new folder something like src/Utility/BacklistEventHandler.php, and wire up the event handler in config/app.php.

On Sunday, February 15, 2015 at 11:25:56 AM UTC-5, HVan wrote:
Let's say I have a table Screenings that holds a number of different screenings and profiles on different people. Then, I have an operation that performs a background check on them (eg. a blacklist check that has no database operations; just a bunch of curl API calls). Where should I place the blacklist check function:

1. in Models/ScreeningTable? That's where I would've placed it in the past.
2. in a new vendor class? If I need to use cake functions (such as CakeLog) would they still work if I have a use statement at the top?
3. in a plugin if I want to keep it isolated? If so, should I create a create a plugin that holds all background check operations and in BackgroundCheckTable inside the plugin?
4. where else?

In Cake2, I would've just placed it in the /Model/Screening.php file but I'm curious what's the proper way to do it.

Thanks

--
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+unsubscribe@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.
For more options, visit https://groups.google.com/d/optout.

No comments: