Yet another HABTM problem with self-referencing model (var useTable)

2008-03-30 Thread ste.ve

I have a Model (Model_1) which is related to itself by a second
model (Model_2) by a HABTM relation. Model_2 uses a custom table
(var $usetable = model_1)

The problem: When I make a find call on Model_1, it returns correctly
the row for itself, and the correct number of rows for Model_2, BUT
all the rows of Model_2 contain the information of Model_1!

For example, I have the model tag related with habtm to tag2 (tag2
has useTable tag). When I query tag for a specific entry, I get tag
and the correct number of tag2, but every tag2 contains the data of
the one tag row.

There is a workaround: when I define the foreignKey and
associationForeignKey and exchange their values, it works!
Like (for Model_1):  'foreignKey' =
'model_1_id','associationForeignKey' = 'model_2_id'. If I don't
define it, or if I defined it the correct way ( 'foreignKey' =
'model_2_id','associationForeignKey' = 'model_1_id') I get the
problem described above.

The SQL generated, however is correct and the same in both szenarios
(and it returns correct results when I try it manually in PhpMyAdmin).
It seems that Cake internally gets the results wrong inside its model
functions.

Is anyone able to reproduce this?

Thanks,
Stefan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Yet another HABTM problem with self-referencing model (var useTable)

2008-03-30 Thread ste.ve

To visualize it better, these are my example Model definitions

WORKS:

class Tag extends AppModel {

var $hasAndBelongsToMany = array(
 'Tag2' = array(
'foreignKey' = 
'tag_id',

'associationForeignKey' = 'tag2_id', )
);

}

class Tag2 extends AppModel {

var $useTable = tags;

var $hasAndBelongsToMany = array(
 'Tag' = array(
 'foreignKey' = 'tag2_id',
 'associationForeignKey' = 'tag_id',
));

}

DOESN'T WORK (in the result set, all rows for Tag2 contain the value
from Tag - the number of results is correct, anyhow)


class Tag extends AppModel {

var $hasAndBelongsToMany = array('Tag2' );

}

class Tag2 extends AppModel {

var $useTable = tags;

var $hasAndBelongsToMany = array( 'Tag' );

}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Cakephp 1.2 Schema could not be loaded

2008-02-22 Thread ste.ve

I got the same problem. Please help!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Cakephp 1.2 Schema could not be loaded

2008-02-22 Thread ste.ve

I get exactly the same error: Error: schema.php could not be loaded.

I tried from every possible folder, with and without the -app
parameter. Please someone help me out!

Or, alternatively, can someone post the sql dump for the Acl tables so
I can skip that weirdy console completely?

Thanks a lot!

Ste.ve

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---