Hello, I'm trying to create these associations that are not really (directly) there on the database level, but should be present in my CakePHP model. To give an idea of what I'm talking about, consider the following example.
Assume three different models: - Location - Event - Photoset With associations as follows: - Location hasMany Event (and Event belongsTo Location) - Event hasMany Photoset (and Photoset belongsTo Event) So on the database level there is no direct reference between Location and Photoset and vice versa. Now I want to add a 'virtual' association to my CakePHP model definition: - Location hasMany Photoset (and Photoset belongsTo Location). The logic behind this association should be clear: all photosets that belong to any event that belongs to a location, should belong to location. I have been trying to create this association by defining a custom hasMany['Photoset'] on Location through a custom query in its 'finderQuery' attribute. This worked fine. But the other way around I cannot think of a way to define the corresponding belongsTo['Location'] on Photoset. I thought of two options: - defining the Photoset->belongsTo['Location'] through a custom query. This is not possible since belongsTo does not provide a 'finderQuery' attribute. - setting the 'foreignKey' attribute of Photoset- >belongsTo['Location'] in such a manner that it would refer to Photoset->data['Event']['location_id']. This did not work either since 'foreignKey' does not seem to accept anything more complex than the name of the foreign key field in the database table of Photoset. Does anyone have some more ideas? Or am I trying to do something that I shouldn't want to do? Thanks a lot, Tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
