Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
not retrieving referenced class automatically if nested
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
 
wizhippo  
View profile  
 More options Apr 24 2008, 9:52 am
From: wizhippo <wizhi...@gmail.com>
Date: Thu, 24 Apr 2008 06:52:51 -0700 (PDT)
Local: Thurs, Apr 24 2008 9:52 am
Subject: not retrieving referenced class automatically if nested
Example

class Agent extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('agents');
        $this->hasColumns(array(
                                                        'agentid' => array(
                                'type' => 'integer',
                                                                'length'   => null,
                                'primary' => true,
                                'sequence' => 'agents_agentid_seq',
                                                                'notnull' => true
                                ),
                                                        'agentlink' => array(
                                'type' => 'integer',
                                                                'length'   => null,
                                                                'notnull' => true
                                ),
                                'commonname' => array(
                                'type'     => 'string',
                                'length'   => 255,
                                'notnull' => true
                                ),
                                'firstname' => array(
                                'type'     => 'string',
                                'length'   => 255,
                                'notnull' => true
                                ),
                                'lastname' => array(
                                'type'     => 'string',
                                'length'   => 255,
                                'notnull' => true
                                ),
                                'middlename' => array(
                                'type'     => 'string',
                                'length'   => 255,
                                'notnull' => false
                                ),
                                                        ));
    }

    public function setUp()
    {
        $this->hasOne('Agent as Parent', array('local' => 'agentlink',
'foreign' => 'agentid'));
        $this->hasMany('Agent as SubAgents', array('local' =>
'agentid', 'foreign' => 'agentlink'));
    }

}

                $agent = Doctrine::getTable('Agent')->find(14);

                echo '<pre>';
                print_r( $agent->Parent->toArray(true) );
                print_r( $agent->SubAgents->toArray(true) );

results

Array
(
    [agentid] =>
    [agentlink] =>
    [commonname] =>
    [firstname] =>
    [lastname] =>
    [middlename] =>
)
Array
(
    [0] => Array
        (
            [agentid] => 15
            [agentlink] => 14
            [commonname] => John Barton
            [firstname] => John
            [lastname] => Barton
            [middlename] =>
        )

)

Notice that the parent is emply. It does work if I use DQL and a join.
using 0.11

Any idea's as to why it automaticaly gets the SubAgents and not the
Parent?


    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.
wizhippo  
View profile  
 More options Apr 24 2008, 10:10 am
From: wizhippo <wizhi...@gmail.com>
Date: Thu, 24 Apr 2008 07:10:14 -0700 (PDT)
Local: Thurs, Apr 24 2008 10:10 am
Subject: Re: not retrieving referenced class automatically if nested
I have done more digging and fount that the parent is not fetched
automatically if my agenlink = 0.

I do not believe this is the correct behavior.

On Apr 24, 9:52 am, wizhippo <wizhi...@gmail.com> wrote:


    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.
wizhippo  
View profile  
 More options Apr 24 2008, 10:55 am
From: wizhippo <wizhi...@gmail.com>
Date: Thu, 24 Apr 2008 07:55:12 -0700 (PDT)
Local: Thurs, Apr 24 2008 10:55 am
Subject: Re: not retrieving referenced class automatically if nested
I have found the probel,

in LocalKey.php on line 49,

        if (empty($id) || ! $this->definition['table']-

>getAttribute(Doctrine::ATTR_LOAD_REFERENCES)) {

if the id = 0 it is considered empty.

I don't believe this should be the case as 0 can be a id value.

On Apr 24, 10:10 am, wizhippo <wizhi...@gmail.com> wrote:


    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.
Jonathan Wage  
View profile  
 More options Apr 28 2008, 4:30 pm
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Mon, 28 Apr 2008 15:30:49 -0500
Local: Mon, Apr 28 2008 4:30 pm
Subject: Re: [doctrine-user] Re: not retrieving referenced class automatically if nested

This is fixed now. I am pretty sure you are the one who created the ticket.
Thanks for uncovering this and reporting it.

- Jon

--
Jonathan Wage
http://www.jwage.com
http://www.centresource.com

    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