Hello all!  I'm just starting to jump in to the wide world of CakePHP
(v1.1 to be safe) and have read through the manual (forgot more than I
remember, but it was good to get acquainted), watched the video
tutorials, and am now going through the IBM DeveloperWorks tutorials
"Cook up Web sites fast with CakePHP".

I've gone through the tutorial, noticing *small* mistakes, errors, and
incompatibilities throughout; most of them I either understood what
was wrong and ignored, or fixed myself.  However, there is one portion
I'm not sure of...

I have two models (in regard to the problem), a User model, and a
Product model.  The relationship is as follows:
User hasAndBelongsToMany Product
Product hasAndBelongsToMany User

In the code examples on the DeveloperWorks site, there was a place for
"users" to create their favorite list of "products".  In doing so, it
called the following code from the products_controller:
$success = $this->Product->User->addFavorite($id);

I keep getting an SQL error that the SQL query of "addFavorite" is
incorrect.  So, what I'm assuming here is that when accessing
variables of a class, if the variable being accessed of a class in a
controller is that of another class, only the variables of that class
are accessible, and functions are not; that functions are expected to
be a query or CakePHP internal function?

The (public) "addFavorite" function does exist within the
users_controller file, but it never runs as Cake is running the name
of the function as a query instead.

Am I missing something simplistic here?  I'm not concerned about the
views or any other functionality, just as to why a function name is
being used as an SQL query.  I have a feeling it would be beneficial
to know this when it comes time for me to finish going through
tutorials and finally sit down and do something for myself.

Thank you for any and all help!  It's much appreciated!  You guys (and
gals) rock! ...or bake!  ;-)


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