Home » Database » DB_DataObject » Bug #3814
Notice: Undefined index: realtor in D:\php-4\pear\DB\DataObject.php on line1900
Details
| Submitted | 2005-03-14 23:03 UTC |
|---|---|
| From | KajKandler at conficio dot com |
| Status | No Feedback |
| Package | DB_DataObject |
| PHP Version | 4.3.9 |
| OS | windows |
| Roadmaps | (Not assigned) |
Comments
[2005-03-14 23:03 UTC] KajKandler at conficio dot com
Description:
------------
Creating an object with a hand coded class and then inserting an object does throw the message
Notice: Undefined index: realtor in D:\php-4\pear\DB\DataObject.php on line1900
My fault?
K<o>
Reproduce code:
---------------
class DataObjects_Town extends DB_DataObject {
// you can define these yourself
var $__table='towns'; // table name
var $id; // int primary_key
var $state; // string
var $county; // string
var $town; // string
var $areaid; // string
// these are usefull to be consistant with a autogenerated file.
/* Static get */
function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Town',$k,$v); }
// now define your table structure.
// key is column name, value is type
function table() {
return array(
'id' => DB_DATAOBJECT_INT,
'state' => DB_DATAOBJECT_STR,
'county' => DB_DATAOBJECT_STR,
'town' => DB_DATAOBJECT_STR,
'areaid' => DB_DATAOBJECT_STR,
);
}
// now define the keys.
function keys() {
return array('id');
}
}
========
$town = new DataObjects_Town();
$town->town = $areaids[2][$i];
$town->state = $state;
$town->areaid = $areaids[1][$i];
// echo "<p>"; print_r($town); echo "</p>";
print_r($town);
$n = $town->find();
echo $n." records found<br/>";
if (! $n) {
echo "insert = ".$town->insert();
}
[2005-03-15 11:38 UTC] KajKandler at conficio dot com
Thanks Alan!
What are sequenceKeys() and how are they defined? I can't find this method in the documentation.
K<o>