PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #532

insert() with key=0

Details

Submitted2004-01-07 11:27 UTC
Fromgarbage at openfutura dot com
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2004-01-07 11:27 UTC] garbage at openfutura dot com

Description:
------------
To create a new record (MySQL) in which i'll put new data, i used to try the following syntax:

$item = new DBO_MyDBObject();
$item->id = 0; //id is the key with auto_increment flag on
$newid = $item->insert();

I have my own class which encapsulates DB_DataObject, and there's a class function (method nuevo()) in which i put the above code (more or less) returning the newly created primary key. I then redefine the methods when needed. But since i do not know the definition of the objects which will inherit this nuevo() method (id is standard and every table i create has its primary key named like that), i cannot state a field to be filled with initial data to insert. I just need EMPTY data, with an auto_incremented key written to this new record.
This method used to work fine until DB_DataObject 1.3 i guess. Now it is broken.

Is there any way you can fix this annoying behaviour?

[2004-01-09 19:02 UTC] garbage at openfutura dot com

Nope. No fix using CVS.
But release 1.3 works fine.

[2004-01-10 10:40 UTC] garbage at openfutura dot com

Certainly fixed.
Just wanted to thank you for your work & time.