Hi,

I've been reading a couple of articles about implementing factory patterns 
in CakePHP but I can't find a hint to solve my actual problem. There is one 
that tries to mimic these kind of patterns using 
behaviors<http://mamchenkov.net/wordpress/2010/02/17/cakephp-building-factories-with-models-and-behaviors/>,
 
but it's not exactly what I'm looking for.

I am developing an application that implements several types of issues 
management: customer complaints, software bugs, medical reviews, etc. The 
core is built around a common set of models: Brand, Customer, Project and 
Issues. A customer can sign up for many brands. What varies from brand to 
brand are Project and Issue, so that there is a LocalProject and its 
ComplaintIssue, a SoftwareProject and its BugIssue, a MedicalCenterProject 
and its ReviewIssue, etc.

Factory patterns suggest to implement to an interface (i.e. using Project 
and Issue classes) and make object instantiation at runtime. Doing that 
it's relatively easy in controllers, e.g you can instantiate $this->Projectin 
ProjectsController according to runtime conditions.

But things get complicated when a hierarchy of relationships is present, 
since model construction is made "behind the scenes" in deep associations. 
Is there a way to define a factory method in CakePHP that can be used to 
decide which concrete class should be used at runtime?

Thanks!!!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to