Hi all !

I need help on a simple issue ... well not so simple for me
Let's resume the situation :

3 tables : Categories , Products and categories_products.
Categories and  Products have a n,m relationship so we've got the
following models :

***** Pour Category.php *****
class Category extends AppModel
{
        var $name = 'Category';
        var $recursive = 1;
        var $hasAndBelongsToMany = array('Product' =>
                                              array('className' =>
'Product'));
}


***** Pour Product.php *****
class Product extends AppModel
{
    var $name = 'Product';
    var $hasAndBelongsToMany = array('Category'  =>
                                                                                
array('className'=> 'Category'));
}


And also those following, nice controllers ;-) :

 ***** categories_controller.php  *****
class CategoriesController extends AppController
{
   var $name = 'Categories';
    var $helpers = array('Html');
    var $uses = array('Category','Product');

        function index()
    {
                $this->set('data', $this->Category->findAll());
                $tester =
$this->Category->findAll('',array('Category.name','Category.description','Product.name'),'','');
                //$tester = $this->Category->findAll();
                $this->set('tester',$tester);
        }


 ***** products_controller.php  *****

class ProductsController extends AppController
{

    var $name = 'Products';
    var $uses = array('Product','Category');
    var $helpers = array('Html');



        function index()
    {
                $this->set('data', $this->Product->findAll());
        }
}

My question is :
in  'CategoriesController', the
findAll('',array('Category.name','Category.description','Product.name'),'','');
call returns :

SQL Error in model Category: 1054: Unknown column 'Product.name' in
'field list'

I first taught it mught be a recursive issue but adding $recursive
did'nt do anything ...

Help !!! Help !!! I'm becoming crazy !!!

(to be honest the idea behind the fact of having the different fields
of multiples table in a same $result would be to do a search engine;
sort of ...)

Thanks for your help !


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

Reply via email to