Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Containable relations reset
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
lightglitch  
View profile  
 More options Nov 4, 7:37 am
From: lightglitch <mario.ffra...@gmail.com>
Date: Tue, 3 Nov 2009 12:37:31 -0800 (PST)
Local: Wed, Nov 4 2009 7:37 am
Subject: Containable relations reset
Hi,

I'm having an error using Containable, my problem is already describe
in https://trac.cakephp.org/ticket/4988 but the explanation of the
problem is not very clear.

So if we have the models:

1 - Node hasMany NodeTemplate
2 - NodeTemplate HasMany TextContent, AssetContent

 When executing the following code:

        pr($this->Node->NodeTemplate->hasMany);
        $this->Node->find('first',array(
                                    'contain'=>array(
                                            'NodeTemplate' => array(

'TextContent'=>array('fields'=>array('id'))
                                                    )
                                        )
                                ));
        pr($this->Node->NodeTemplate->hasMany);

The hasMany NodeTemplate break and looses the connection to
AssetContent.

After some debugging I did found out that the problem is in the
configuration of the TextContent in the contain.

If you try:

        pr($this->Node->NodeTemplate->hasMany);
        $this->Node->find('first',array(
                                    'contain'=>array(
                                            'NodeTemplate' => array(
                                                        'TextContent'
                                                    )
                                        )
                                ));
        pr($this->Node->NodeTemplate->hasMany);

OR

        pr($this->Node->NodeTemplate->hasMany);
        $this->Node->find('first',array(
                                    'contain'=>array(
                                            'NodeTemplate' => array(

'TextContent'=>array('OtherModel')
                                                    )
                                        )
                                ));
        pr($this->Node->NodeTemplate->hasMany);

It works ok.

if you use any parameter that is not a associated Model name like
fields, conditions, order, etc it doesn't work and breaks the
associations of the NodeTemplate by losing the one that is not used in
the contain.

Can anyone confirm this behavior? I'm using 1.2.5 version of cake.

Thx in advance.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Andersen  
View profile  
 More options Nov 4, 5:47 pm
From: John Andersen <j.andersen...@gmail.com>
Date: Tue, 3 Nov 2009 22:47:30 -0800 (PST)
Local: Wed, Nov 4 2009 5:47 pm
Subject: Re: Containable relations reset
Using 1.2.5 too, can't recreate the issue.

User hasMany Author hasMany Article, Ebook
[code]
      debug($this->User->hasMany);
      debug(
      $this->User->find('first',array(
         'contain'=>array(
            'Author' => array(
               'Article' => array('fields' => array('id') )
            )
         )
      ))
      );
      debug($this->User->hasMany);
[/code]

Shows the same state of hasMany before and afther the find.

Please show the code that defines how your models are related!

The ticket is closed as fixed!
Enjoy,
   John

On Nov 3, 10:37 pm, lightglitch <mario.ffra...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Andersen  
View profile  
 More options Nov 4, 5:49 pm
From: John Andersen <j.andersen...@gmail.com>
Date: Tue, 3 Nov 2009 22:49:46 -0800 (PST)
Local: Wed, Nov 4 2009 5:49 pm
Subject: Re: Containable relations reset
DISREGARD, just saw the real issue, not at the User hasMany, but at
the Author hasMany!
Yes, I see the same problem!
Enjoy,
   John

On Nov 4, 8:47 am, John Andersen <j.andersen...@gmail.com> wrote:

> Using 1.2.5 too, can't recreate the issue.

> User hasMany Author hasMany Article, Ebook

[snip]

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc  
View profile  
 More options Nov 4, 10:41 pm
From: Marc <crams...@gmail.com>
Date: Wed, 4 Nov 2009 03:41:55 -0800 (PST)
Local: Wed, Nov 4 2009 10:41 pm
Subject: Re: Containable relations reset
I updated the ticket with a test to prove your issue.

On 4 nov, 07:49, John Andersen <j.andersen...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google