Dear all,

I have  a self-associated model. I have a foreign field account_id
inside the accounts table and also have declared Account model into
the hasMany and belongsTo arrays.
Namely: account.php:
class Account extends AppModel
{
        var $name = 'Account';
        var $hasMany = array('Account', 'Order', 'ShoppingCart');
        var $belongsTo = array('Account','Country', 'State',
'PaymentMethod' , 'ShippingMethod');
...
This is giving me problems big problems with findall() when recursive
queries are set.
What I have figured out that it tries to do is to self LEFT JOIN
accounts with accounts:
"AS `Account` LEFT JOIN `accounts` AS `Account`"
both naming them as Account so it returns:
SQL Error: 1066: Not unique table/alias: 'Account'

I am using cakephp 1.1.x versions
Do you if what I am trying to achieve is the correct way to do things
or not?
Is there another way of working with self associated models and get
recursive queries on them n-levels deep ???

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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