Re: DB_Object->find not in sync with documentation?
| From: | Justin Patrin | Date: | Mon, 15 Nov 2004 18:13:46 +0000 |
| Subject: | Re: DB_Object->find not in sync with documentation? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15523@lists.php.net to get a copy of this message | ||
On Sun, 14 Nov 2004 16:26:01 -0800, Ken Restivo <ken@restivo.org> wrote:
> The docs for DB_Object->find() offer an example:
> $person = new DataObjects_Person;
> $person->hair = 'red';
> $person->has_glasses = 1;
> $number_of_rows = $person->find();
>
> I figure, great, I'll do that too.
> $obj = DB_DataObject::factory ('income');
> $obj->txn_id = 'foobar';
> $numrows = $obj->find() ;
>
> Ah, but DebugLevel(5) shows:
> income: QUERY: SELECT * FROM income
>
> print_r($obj) shows that txn_id is in fact set to 'foobar'.
>
> WTF? Why isn't it adding the txn_id to the where clause? Docs imply that it should.
>
> I'm using:
> DB_DataObject 1.7.2 stable
>
Are you sure that field is set up in your db.ini file? And in the
generated class? If you don't have the field in there this won't work.
This kind of thing happens when you change your DB structure after
generating the files. Just re-run the createTables.php (only stuff
between the autogenerated tags will be changed).
--
Justin Patrin