Re: Re: DB_DataObject::getLinks() totally broken?

From: Date: Fri, 05 Dec 2003 17:43:07 +0000
Subject: Re: Re: DB_DataObject::getLinks() totally broken?
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24204@lists.php.net to get a copy of this message
To have a meaningful DataObject, it needs to have entries in the main database ini file. These are created for you with createTables.php... Did you not auto-generate the classes? If so, you're wasting a lot of setup time. You can always modify the classes after they're generated. Joe Stump wrote:
Could you show us the related links.ini entry?
I did - it's at the bottom. I found out my problem and I suppose it makes sense, but it is *very* annoying. Simply put - if your second table IS in your links.ini file but not in your table ini file then everything breaks. Am I totally off my rocker in thinking that even if it's not defined it should still work? I've yet to realize the use of the regular ini files, other than I now know that all hell breaks loose if everything isn't defined. By adding content and contnet__keys to my ini file everything was fixed. --Joe
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."
-- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy."


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