Got it. Can I make a suggestion? This suggests poor data integrity as child 
records (favs) can exist after the parent record (products) have been deleted. 
Would it not be better to mark a product as 'deleted' rather than actually 
deleting it?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jul 2010, at 15:21, brototyp wrote:

> @Jeremy: Normally these Fields would be the same. But the Product
> table is changing every day. And if a product is gone, I need the
> Information the favs table (That a user added a pruduct to his favs,
> which isn't there anymore), so I can't just join these two tables.
> 
> @Master Ram: Thanks for your answer, I tried Sams solution, but Im
> sure your is working also.
> 
> @Sam: Thanks Sam solution seems to work. I added in my Fav Model:
> 
> var $belongsTo = array(
>        'Product' => array(
>            'className'     => 'Product',
>            'foreignKey'    => false,
>            'conditions'    => 'Product.zupid = Fav.zupid'
>        )
> 
> and all information shows up.
> 
> What doesn'T work so far is connecting the Product to Favs table. My
> code gets interrupted by adding this:
> 
> In your Product model...
> var $hasMany = array(
>    'Fav' => array(
>        'className'     => 'Fav',
>        'foreignKey'    => false,
>        'conditions'    => 'Product.zupid = Fav.zupid'
>    )
> 
> I will try some more time. And if it doesn'T work, I will come back to
> you.
> 
> Thanks guys for your help, App it.
> 
> Best,
> Björn
> 
> 
> 
> 
> 
> 
> On 13 Jul., 07:02, Sam <s...@masterscommission360.com> wrote:
>> Assuming your favs table produces a Fav model(note, I haven't tested
>> this but it *should* work)
>> In your Fav model...
>> var $belongsTo = array(
>>         'Product' => array(
>>             'className'     => 'Product',
>>             'foreignKey'    => false,
>>             'conditions'    => 'Product.zupid = Fav.zupid'
>>         )
>> 
>> In your Product model...
>> var $hasMany = array(
>>     'Fav' => array(
>>         'className'     => 'Fav',
>>         'foreignKey'    => false,
>>         'conditions'    => 'Product.zupid = Fav.zupid'
>>     )
>> 
>> On Jul 12, 6:56 pm, brototyp <b.geh...@gmail.com> wrote:
>> 
>>> Hi guys, I'm pretty new in Cake and I have an issue with connecting
>>> two tables.
>> 
>>> I have a product table (product) with:
>> 
>>> id (auto increment), zupid (a unique product id key), productname,
>>> product_id, product price  .........
>> 
>>> and an other table (favs) with:
>> 
>>> id (auto increment), zupid, user_id, stats.
>> 
>>> Now I would like to connect those tables somehow with zupid as key (it
>>> has to be zupid).
>>> The reason for connecting is, that I want to have all product data
>>> when accessing the fav table in the favs view.
>>> So far, I only get the data from the favs table.
>> 
>>> Thanks in advance!
>>> Best,
>>> b
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to