On Friday, 9 March 2012 15:28:56 UTC, Rodrigo Rodrigues Moyle wrote:
>
> Please, show you table schema and model association setup.


Everything follows conventions (as they should do wherever possible) so I 
have:

Relevant table fields: 
delegates (id, ..., booking_count, alternative_count, ...)
booking_delegates (id, ..., delegate_id, alternative_delegate_id, ...)

Relevant model associations:

Booking:
public $hasMany = array(
  'BookingDelegate' => array(
    'className' => 'BookingDelegate',
    'foreignKey' => 'delegate_id',
    'dependent' => true,
  ),
  'BookingAlternativeDelegate' => array(
    'className' => 'BookingDelegate',
    'foreignKey' => 'alternative_delegate_id',
    'dependent' => true,
  ),
);

BookingDelegate:
public $belongsTo = array(
  ...
  'Delegate' => array(
    'className' => 'Delegate',
    'foreignKey' => 'delegate_id',
    'counterCache' => 'booking_count'
  ),
  'AlternativeDelegate' => array(
    'className' => 'Delegate',
    'foreignKey' => 'alternative_delegate_id',
    'counterCache' => 'alternative_count'
  ),
  ...
);

However, due to the very specific nature of when this issue occurs I very 
much doubt this is simply down to an error in conventions.  

Thanks, Paul.

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

Reply via email to