In order to fetch data from both tables, you need to join them, Cake
won't do this automagically.

On Dec 26, 5:40 pm, "Chad Casselman" <ccassel...@gmail.com> wrote:
> Should it bring in all hardcoded (model) associations when I import them?
>
> Here is what I have and I can't pull any fields from Sequences or
> PackagesSequence objects/tables
>
>     var $uses = array('Package','Sequence','PackagesSequence');
>     $extra = array(
>                 'recursive' => 1, //int
>                 'fields' => array('Package.name', 'Sequence.name'), //array
> of field names
>             );
>
>      $this->Package->find('all', $extra);
>
> I get an error that it doesn't know the Sequence table.  Thoughts?  Do I
> have to recode the associations already in the models?
>
> Chad
>
> On Fri, Dec 26, 2008 at 6:26 PM, Arthur Pemberton <pem...@gmail.com> wrote:
>
> > On Fri, Dec 26, 2008 at 5:14 PM, Chad Casselman <ccassel...@gmail.com>
> > wrote:
> > > I have a Controller for Jobs with a model Job.
>
> > > When I hit /jobs  (the index function of Job Controller), I need to run a
> > > query on 2 other tables (not joined to Job) to find values to manually
> > > insert into jobs before actually displaying the index.
>
> > > I have tried several things but can't seem to make any progress on this.
>
> > > Can anyone help me with this?
>
> > > 1) select fields from a join on customers and packages (complex
> > conditions)
>
> > I believe you want to bind those models to each other [1]
>
> > > 2) iterate through results and insert/update values in job
>
> > Once you setup the appropriate bindings, you can do a find('all') on
> > them and iterate over the results of that. [2] may be clearer.
>
> > > 3) display jobs
>
> > I'm guessing that part already works with your index() action.
>
> > > Thank you in advance.
>
> > > Chad
>
> > [1]
> >http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-...
> > [2]http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
>
> > --
> > Fedora 9 : sulphur is good for the skin
> > (www.pembo13.com)
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to