Hello,

I’ve developed a fairly complex application on CakePHP 2.4.X, and at this point 
I’ve encountered this issue.

Say I have a model, called Cake. Cakes may be baked in-house or purchased from 
a factory.

Now, say that a Cake model instance has a belongs-to association to the “pastry 
cook” and “factory” models. This is trivial to set up using separate fields for 
each field.

My question is: how can I unify this so that I have an “origin_id” field that 
transparently maps to a “pastry cook” or a “factory”, provided I can somehow 
differentiate them by the contents of the fields (say all cook ids start with 
“c” and factory ids, with “f”)? I know this can be solved while reading in a 
fairly straightforward (though dirty) way using virtual fields and callbacks. 
My question is about doing this in a transparent way that also works for 
saving/validating cakes. I need not create new cooks or factories through 
saveMany/saveAll though.

Thanks,

Ricardo Vieitez | Student Assistant - Network Administration
University of Florida Department of Housing and Residence Education
PO Box 112100 | Gainesville, FL 32611-2100
office 352.392.2171 x10355 | fax 352.392.6819 | 
[email protected]<mailto:[email protected]>
StrengthsQuest Top 5: Analytical, Strategic, Learner, Responsibility, Relator - 
Find Out More<http://www.strengthsquest.com/content/141728/index.aspx>
Please consider the environment before printing this email.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to