These are the models of Tor with the significant associations

 

<?php

class Dealer extends AppModel

{

    var $name = 'Dealer';

 

    var $hasMany = array('Product' => array (

        'className' => 'Product',

        'conditions'=> '',

        'order'=> '',

        'foreignKey' => 'dealer_id')

    );

. . . . . . . . . . . rest of model

 

 

<?php

  class Product extends AppModel

  {

    var $name = 'Product';

    var $belongsTo = array ('Dealer' => array(

        'className' => 'Dealer',

        'conditions'=> '',

        'order'=> '',

        'foreignKey'=>'dealer_id')

    );

    var $hasAndBelongsToMany = array( 'User' =>

        array(

            'className' => 'User'

        )

    );

  }

?>

 

<?php

class User extends AppModel

{

    var $name = 'User';

 

    var $hasAndBelongsToMany = array( 'Product' =>

        array (

            'className' => 'Product'

        )

    );

. . . . . . . . . . . rest of model