I forgot to mention. In the bake process I made an alias for the
buyer, classname buyer, foreign id as the table field 'buyer id'. But,
when testing, I get the "Database table buyers for model Buyer was not
found."
This is how the model is defined (it's just a cut and paste of some
parts)
public $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Buyer' => array(
'className' => 'Buyer',
'foreignKey' => 'buyer_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
On 8 Dic, 11:44, denisr <[email protected]> wrote:
> Hi,
>
> I am a bit confused on how can I link together two models, where the
> first model has 2 fields linked with the same model.
>
> Basically, the first model is about a product on a consumer swapping
> site, so it will have these fields:
>
> **model product
> user_id (the id of the user that submitted the item)
> buyer_id (the id of the user that will get the item later)
>
> **model user
> id (the id of the table)
> username (the username of that user)
>
> I am a bit confused on how should I link these models when baking.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php