Re: DB_DataObject::getLinks() totally broken?

From: Date: Fri, 05 Dec 2003 17:23:01 +0000
Subject: Re: DB_DataObject::getLinks() totally broken?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24202@lists.php.net to get a copy of this message
Could you show us the related links.ini entry? Joe Stump wrote:
I'm beating my head against the wall on this one ... Here is my code:
          $comments = & new DataObjects_Blog_comments();
          $comments->entryID = $entry->contentID;
          if($comments->find())
          {
            $arr = array();
            while($comments->fetch())
            {
              $comments->getLinks();
              echo '<pre>'; print_r($comments); echo '</pre>';
              $arr[] = $comments->__clone();
            }
            echo '<pre>'; print_r($arr); echo '</pre>';
            $this->setData('comments',$arr);
          }
And here is my output: dataobjects_blog_comments Object (
    [_DB_DataObject_version] => 1.3
    [__table] => blog_comments
    [N] => 2
    [_database_dsn] =>
    [_database_dsn_md5] => 2c76ae5381cb31453eccd4e0761fd402
    [_database] => josephstump
    [_DB_resultid] => 2
    [_link_loaded] =>
    [_join] =>
    [_lastError] =>
    [contentID] => 479257226
    [entryID] => 291345797
    [name] => Joseph Stump
    [email] => joe@joestump.net
    [url] =>
    [comments] => asdf asdf asdf
    [_contentID] => dataobjects_content Object
        (
            [_DB_DataObject_version] => 1.3
            [__table] => content
            [N] => 13
            [_database_dsn] =>
            [_database_dsn_md5] => 2c76ae5381cb31453eccd4e0761fd402
            [_database] => josephstump
            [_DB_resultid] => 3
            [_link_loaded] =>
            [_join] =>
            [_lastError] =>
            [contentID] => 851626192
            [userID] => 133465235
            [posted] => 1070225887
            [lastUpdate] => 1070225887
            [available] => 1
            [mime] => JxAdminBlogCategories
            [title] => Work
            [module] => blog
        )
) Here is my relevant links.ini def: [blog_comments] contentID = content:contentID Am I totally off base in assuming that the link (contentID in this case) should be the same in both my primary class ($comments) and my link class ($comments->_contentID)? It just grabs the first record in the table and slaps it in there. Should it be doing this instead: "SELECT * FROM content WHERE contentID=$comments->contentID" --Joe -- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy."


« previous php.pear.dev (#24202) next »