Wednesday, August 5, 2009

Re: Full HABTM Example

Actually, I think that should be

Array
(
[0] => Array
(
[Dolist] => Array
(

What result do you get? Anything?

On Wed, Aug 5, 2009 at 7:34 AM, Taff<taff.lawley@googlemail.com> wrote:
>
> I'm getting nowhere, so I'll try and outline my setup in the hope that
> someone can help me out.
>
> I have a Model called dolist.php
>
> var $hasAndBelongsToMany = array(
>                'Tag' => array(
>                        'className' => 'Tag',
>                        'joinTable' => 'dolists_tags',
>                        'foreignKey' => 'dolist_id',
>                        'associationForeignKey' => 'tag_id',
>                        'unique' => true
>                )
>        );
>
> My dolists table has this setup:
>
>            [id] => 1
>            [name] => A first list
>            [order] => 1
>            [created_on] => 2009-07-25
>
>
> I have a model called tag.php
>
> var $hasAndBelongsToMany = array(
>                'Dolist' => array(
>                        'className' => 'Dolist',
>                        'joinTable' => 'dolists_tags',
>                        'foreignKey' => 'tag_id',
>                        'associationForeignKey' => 'dolist_id',
>                        'unique' => true
>                )
>        );
>
> My tags table looks like
>
>            [id] => 1
>            [name] => Tag 1
>
> I have a table called dolists_tags
>
> id      dolist_id       tag_id
>
> According to all the tutorials I have attempted to follow
>
> $lists=$this->Dolist->find();
>
> should return:
>
> Array
> (
>    [Dolist] => Array
>        (
>            [id] => 1
>            [name] => A first list
>            [order] => 1
>            [created_on] => 2009-07-25
>        )
>    [Tag] => Array
>        (
>            [0] => Array
>                (
>                    [id] => 1
>                    [name] => Tag 1
>                )
>        )
> )
>
> I have a feeling I'm missing something elementary, and hopefully
> someone with more experience can help me take advantage of the great
> functionality that cakePHP offers.
>
> Cheers,
> Taff
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: