Login | Register
My pages Projects Community openCollabNet

Discussions > users > Following example and get errors on $book->getAuthor()->getFirstName();

propel
Discussion topic

Back to topic list

Following example and get errors on $book->getAuthor()->getFirstName();

Reply

Author "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com>
Full name "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com>
Date 2005-05-09 18:11:41 PDT
Message Hi.

 

Thanks for all your help today. I have successfully set up my propel
environment and now I am running my first code. I have modified the last php
code example in the Users Guide::Getting Started to suit my database.

 

Instead of having Books, Publishers and Authors, I have Users and
Userdetails.

 

I have successfully run this code (similar to example):

 

$users = new Users();

$users->setLogin("halli");

$users->setPassw​ord("kalli");

 

$userdetails = new Userdetails();

$userdetails->se​tEmail("gthth at efs dot is​");

$userdetails->se​tFirstname("fafsfd")​;

$userdetails->se​tLastname("Mylastnam​e");

$userdetails->se​tIpregistered("ip talan min");

$userdetails->se​tTimeregistered("0")​;

$users->addUserd​etails($userdetails​);

 

$users->save();

 

But this code:

 

$c = new Criteria();

$c->add(UsersPeer::LOGIN , "hal%", Criteria::LIKE);

$c->setLimit(10); // just in case we keep running this script :)

 

$users = UsersPeer::doSelect($c);

 

if ($users) {

  print "<p><strong>Found users!</strong​></p>";

 

/* @var $user users */

  foreach($users as $user) {

    print "<br/>" . $user->getLogin() . ", og password " .

          $user->getUserde​tailss()->getFirs​tname();

          //$user->getUserdetailss()

  }

} else {

  print "<p><strong>Did NOT find users!</strong​></p>";

}

 

Returns the error:

 

Fatal error: Call to a member function getFirstname() on a non-object in
/var/www/devel/stocks/db.php on line 101

 

Please note this (probably related) anomaly. Every get%Other_table% has an
extra ‘s’ in the name. I.e. I have the tables Userdetails and Transactions
(not in this example) and the get methods defined in /om/BaseUsers.php has
an extra ‘s’ in the name, getUserdetailss() and getTransactionss().

The set methods do not.

 

Do you have any idea what is going on? Thanks a lot for your help today.
Attachments

« Previous message in topic | 1 of 17 | Next message in topic »

Messages

Show all messages in topic

Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-09 18:11:41 PDT
     Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); hlellelid Hans Lellelid 2005-05-09 18:24:41 PDT
         RE: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-09 18:41:19 PDT
             Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); hlellelid Hans Lellelid 2005-05-09 18:46:33 PDT
                 RE: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-09 18:51:41 PDT
                     Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); hlellelid Hans Lellelid 2005-05-09 19:00:11 PDT
                         RE: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-10 04:39:49 PDT
                 Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2005-05-09 19:08:33 PDT
                     Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); hlellelid Hans Lellelid 2005-05-09 19:09:32 PDT
                     RE: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-10 04:58:15 PDT
                         Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2005-05-10 05:40:31 PDT
                             RE: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-10 05:46:26 PDT
                                 Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2005-05-10 05:56:18 PDT
                                     RE: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> "=?iso-8859-1?Q?Hallgr=EDmur_Th dot _Bj=F6rnsson?=" <hallgrimur at gmail dot com> 2005-05-10 07:48:05 PDT
                                         Re: [propel] Following example and get errors on $book-&gt;getAuthor()-&gt;getFirstName(); Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2005-05-11 00:54:57 PDT
                 Help with a simple join in Propel/PHP 4 Bryan Donovan <brdonovan at gmail dot com> Bryan Donovan <brdonovan at gmail dot com> 2005-05-09 19:21:04 PDT
                     Re: [propel] Help with a simple join in Propel/PHP 4 cyruzb Bert Van den Brande 2005-05-09 22:57:42 PDT
Messages per page: