Re: basic relation question

2011-09-23 Thread WebbedIT
Don't just switch relations because one works and one does not, use
the right relationship for the right type of join.

Which tables have you now joined with HABTM?

As soon as you start wanting data from tables that are more than one
relation deep you really need to start using Containable, it is very
powerful and makes like so much more useful.  I rarely find myself
forcing joins anymore now that I know exactly how to join my models
and how to leveradge containable to get the data I want.

I also rarely find myself using HABTM as I much prefer modelising my
join table and specifying

ModelA and ModelB hasMany JoinModel
JoinModel belongsTo ModelA and ModelB

This allows you to do much better finds and have more control over
extra fields in the join table.

HTH, Paul.

On Sep 23, 8:19 pm, Seth  wrote:
> Thanks for the info.  I tried to bake it, but it errored, so instead
> of debugging that, I just focused on the models.  Looks like I wasn't
> doing it right, so I just switched to a HABTM and created the middle
> tables.
> Working now and gives some room for change if specs change.
>
> On Sep 23, 12:45 pm, Zaky Katalan-Ezra  wrote:
>
>
>
>
>
>
>
> > If the relationship are all there in all models you may change to
> > $this->track->recursive = 1;
>
> > if not try to build your models with "./cake bake all" in order to see the
> > suggested relationship.
>
> > On Fri, Sep 23, 2011 at 6:20 PM, Seth  wrote:
> > > I'm very new to CakePHP and MVC, so this is probably basic.  Just need
> > > a push in the right direction.
>
> > > I've got Event to many Courses to one Instructor
> > > If I'm on a Event view, it sees the Courses, but doesn't join to the
> > > instructor.
>
> > > So, do I add the instructor somehow to the Event model or do I edit
> > > the controller to join the instructor in?
> > > I thought the model would look further down.
>
> > > Thanks for the help
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > 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
> > > athttp://groups.google.com/group/cake-php

-- 
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


Re: basic relation question

2011-09-23 Thread Seth
Thanks for the info.  I tried to bake it, but it errored, so instead
of debugging that, I just focused on the models.  Looks like I wasn't
doing it right, so I just switched to a HABTM and created the middle
tables.
Working now and gives some room for change if specs change.

On Sep 23, 12:45 pm, Zaky Katalan-Ezra  wrote:
> If the relationship are all there in all models you may change to
> $this->track->recursive = 1;
>
> if not try to build your models with "./cake bake all" in order to see the
> suggested relationship.
>
>
>
>
>
>
>
> On Fri, Sep 23, 2011 at 6:20 PM, Seth  wrote:
> > I'm very new to CakePHP and MVC, so this is probably basic.  Just need
> > a push in the right direction.
>
> > I've got Event to many Courses to one Instructor
> > If I'm on a Event view, it sees the Courses, but doesn't join to the
> > instructor.
>
> > So, do I add the instructor somehow to the Event model or do I edit
> > the controller to join the instructor in?
> > I thought the model would look further down.
>
> > Thanks for the help
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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
> > athttp://groups.google.com/group/cake-php

-- 
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


Re: basic relation question

2011-09-23 Thread Zaky Katalan-Ezra
If the relationship are all there in all models you may change to
$this->track->recursive = 1;

if not try to build your models with "./cake bake all" in order to see the
suggested relationship.

On Fri, Sep 23, 2011 at 6:20 PM, Seth  wrote:

> I'm very new to CakePHP and MVC, so this is probably basic.  Just need
> a push in the right direction.
>
> I've got Event to many Courses to one Instructor
> If I'm on a Event view, it sees the Courses, but doesn't join to the
> instructor.
>
> So, do I add the instructor somehow to the Event model or do I edit
> the controller to join the instructor in?
> I thought the model would look further down.
>
> Thanks for the help
>
> --
> 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
>

-- 
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


basic relation question

2011-09-23 Thread Seth
I'm very new to CakePHP and MVC, so this is probably basic.  Just need
a push in the right direction.

I've got Event to many Courses to one Instructor
If I'm on a Event view, it sees the Courses, but doesn't join to the
instructor.

So, do I add the instructor somehow to the Event model or do I edit
the controller to join the instructor in?
I thought the model would look further down.

Thanks for the help

-- 
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