It does take away cakePHP's "automagic" right. How do I go about
implementing this in the cakePHP model and controller?

On Mar 4, 10:39 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> True. But I meant in the database itself. Although, one can create a
> unique index on (model, foreign_key).
>
> On Tue, Mar 4, 2008 at 12:30 PM, Dardo Sordi Bogado
>
> <[EMAIL PROTECTED]> wrote:
>
> >  You can use it as foreign key and specify that the creator_class =
> >  'something' in the conditions (you can put condiftions to
> >  associations).
>
> >  On Tue, Mar 4, 2008 at 3:03 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> >  >  That's what I'm doing for a couple of my tables. I have a foreign_key
> >  >  field and a model field. It does mean that one cannot define a proper
> >  >  foreign key so you'll need to write some logic to handle that
> >  >  association.
>
> >  >  On Tue, Mar 4, 2008 at 8:01 AM, chefsmart <[EMAIL PROTECTED]> wrote:
>
> >  >  >  Thanks for your input. If I understand you correctly, you're
> >  >  >  suggesting I have a creator_id column in my agencies table and 
> > another
> >  >  >  creator_class column to indicate the type of creator. I guess then I
> >  >  >  wouldn't be able to define creator_id as a foreign key. Am i getting
> >  >  >  this correctly?
>
> >  >  >  On Mar 4, 4:24 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> >  >  >  > I would go using a creator_id and creator_class, then use one as 
> > the
> >  >  >  > foreingKey and the other as a condition in the associations.
>
> >  >  > > On Tue, Mar 4, 2008 at 7:31 AM, chefsmart <[EMAIL PROTECTED]> wrote:
>
> >  >  >  > >  Hi all,
>
> >  >  >  > >  I just started out with cakePHP and am quite impressed by how 
> > much can
> >  >  >  > >  be achieved in a short time.
>
> >  >  >  > >  I'm stuck with a design issue and need some guidance. Please.
>
> >  >  >  > >  Let's say I have two models: 1) Counsellor 2) Coordinator. 
> > There is a
> >  >  >  > >  third model called Agency. An Agency can only be created by a
> >  >  >  > >  Counsellor or a Coordinator. I need to store information in the
> >  >  >  > >  database about each Agency's creator.
>
> >  >  >  > >  Now if I call my database field agencies.createdby, how would I 
> > go
> >  >  >  > >  about tying it up with cakePHP's convention? How would I go 
> > about
> >  >  >  > >  determining whether the creator was a Counsellor or a 
> > Coordinator?
> >  >  >  > >  Should I have two fields (coordinator_id, and counsellor_id) in 
> > the
> >  >  >  > >  database in place of one createdby field?
>
> >  >  >  > >  Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to