Unfortunately, defining the fake model association in the Bookmarks
model caused the normal $this->Bookmark->findAll() requests in other
actions to return multiple records for each bookmark :(



> Note, that I didn't use bindModel() on the fly, because I couldn't
> find a way to make the binding persistent. The pagination component
> makes a cuple of sql queries to get the pages, etc. so the
> associations gets reset to the ones defined in the models after the
> first query.
>
> The API for Cake 1.2 has a second parameter for
> Model::bindModel(array(), $reset = true) which can be passed as FALSE
> to make the bindings persistent. However, the API for Cake 1.1 doesn't
> have such a parameter, so I've associated the fake modek in the
> Bookmark's model definition.
>
> ### Models
>
> # bookmark.php
>
> class Bookmark extends AppModel
> {
>     var $name = 'Bookmark';
>
>     var $hasAndBelongsToMany =  array('Tag' =>
>                                     array('className'    => 'Tag',
>                                             'joinTable'    =>
> 'bookmarks_tags',
>                                             'foreignKey'   =>
> 'bookmark_id',
>                                             'associationForeignKey'=>
> 'tag_id',
>                                             'conditions'   => '',
>                                             'order'        => '',
>                                             'limit'        => '',
>                                             'unique'       => true,
>                                             'finderQuery'  => '',
>                                             'deleteQuery'  => '',
>                                     )
>                                 );
>
>     // NOTE: the fake association
>     var $hasOne = array(
>                     'BookmarkTagAssoc' =>
> array('className'=>'BookmarkTag')
>                   );
>
> }


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