Just an update: after quite a bit of debugging, found the cause. I
had defined 'app/app_model.php' as follows:
... the $name variable had caused this error; removing that line made
all of my HABTM associations work again.
On Jun 5, 5:30 pm, "bcm...@gmail.com" wrote:
> Hi
>
> I am trying to define and use a HABTM relationship between "listings"
> and "tags". I have the relationships defined using code from the cake
> docs, and I have the 'tags' controller set up with scaffolding.
>
> When I view a tag (tags/view/1) in the scaffolding (which has several
> listings associated with it), the tag's information shows up fine, but
> the section under "Related Listings" is blank. BUT the query that is
> being run is grabbing the related listings properly; I ran it on my DB
> through phpMyAdmin and it returned all of the related listings
> properly-- any idea what could be causing this? What am I doing
> wrong?
>
> Thanks!
>
> -- code ---
>
> class Tag extends AppModel
> {
> var $name = 'Tag';
> var $hasAndBelongsToMany = array(
> 'Listing' =>
> array(
> 'className' => 'Listing',
> 'joinTable' => 'listings_tags',
> 'foreignKey' => 'tag_id',
> 'associationForeignKey' => 'listing_id',
> 'unique' => true,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'finderQuery' => '',
> 'deleteQuery' => '',
> 'insertQuery' => ''
> )
> );
>
> } //Tag model
>
> class Listing extends AppModel
> {
> var $name = 'Listing';
> ...
> var $hasAndBelongsToMany = array(
> 'Tag' =>
> array(
> 'className' => 'Tag',
> 'joinTable' => 'listings_tags',
> 'foreignKey' => 'listing_id',
> 'associationForeignKey' => 'tag_id',
> 'unique' => true,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'finderQuery' => '',
> 'deleteQuery' => '',
> 'insertQuery' => ''
> ));
>
> } //Listing model
>
> class TagsController extends AppController
> {
> var $name = 'Tags';
> var $scaffold;
>
>
>
> } //Tags controller
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---