Re: Re: DB_DataObject

From: Date: Sun, 01 Sep 2002 13:22:41 +0000
Subject: Re: Re: DB_DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2225@lists.php.net to get a copy of this message
Ok, I'm guessing a few things here. 1) it may not be finding the links file.. It appears to be semi correctly assuming default behavior - eg. the column name members_id would infer a link to the primary key of the members table.. make sure you are using the CVS version, there was a bug in the released code for the getlinks stuff. =- this may be causing this error. otherwise have a look at link 841 of DataObject.php - which loads the file and just echo the filename to the screen - and echo 'loaded OK' regards Alan .. .. wrote:
ok... im still not really getting the result i need so ill just show you what im doing... i have 2 tables CREATE TABLE members ( members_id int(10) unsigned NOT NULL auto_increment, firstname varchar(250) NOT NULL default '', lastname varchar(250) NOT NULL default '', company varchar(250) NOT NULL default '', phone1 varchar(250) NOT NULL default '', phone2 varchar(250) NOT NULL default '', mobile varchar(250) NOT NULL default '', email varchar(250) NOT NULL default '', fax varchar(250) NOT NULL default '', address1 text NOT NULL, address2 text NOT NULL, suburb varchar(250) NOT NULL default '', state varchar(250) NOT NULL default '', postcode varchar(250) NOT NULL default '', registeredon datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (members_id) ) CREATE TABLE bookings ( id int(10) unsigned NOT NULL auto_increment, members_id int(10) unsigned NOT NULL default '0', racesid int(10) unsigned NOT NULL default '0', transdesc text NOT NULL, transtype varchar(250) NOT NULL default '', transtodetails text NOT NULL, transfromdetails text NOT NULL, transbusdetails text NOT NULL, transnotes text NOT NULL, cateringoptions_id int(10) unsigned NOT NULL default '0', cateringnumpeople int(11) NOT NULL default '0', cateringnotes text NOT NULL, bookerscode varchar(250) NOT NULL default '', bookingdate datetime NOT NULL default '0000-00-00 00:00:00', notes text NOT NULL, numofpeople smallint(5) unsigned NOT NULL default '0', status varchar(250) NOT NULL default '', cctype varchar(250) NOT NULL default '', ccnumber varchar(250) NOT NULL default '', ccexpdate varchar(250) NOT NULL default '', bookinammount varchar(250) NOT NULL default '', roc varchar(250) NOT NULL default '', PRIMARY KEY (id) ) linked by the field member_id im executing the following code links file: [members] members_id = bookings:members_id $member = new DataObjects_Members; $member->get(1); $member->getLinks(); print_r($member);?> the result that it returs dataobjects_members Object ( [__table] => members [members_id] => 1 [firstname] => richard [lastname] => udo [company] => egnited [phone1] => 111 [phone2] => 222 [mobile] => 333 [email] => yourhoast@hotmail.com [fax] => 444 [address1] => somewhere1 [address2] => somewhere2 [suburb] => somewhere3 [state] => somewhere4 [postcode] => somewhere5 [registeredon] => 2002-08-30 14:58:42 [_DB_DataObject_version] => 1.0 [N] => 1 [_database_dsn] => [_database_dsn_md5] => ae07522950ca1af18e019b3935f14214 [_database] => auscarts [_condition] => [_group_by] => [_order_by] => [_limit] => [_data_select] => * [_DB_resultid] => 0 [_link_loaded] => 1 [_lastError] => [_members_id] => dataobjects_members Object ( [__table] => members [members_id] => 1 [firstname] => richard [lastname] => udo [company] => egnited [phone1] => 111 [phone2] => 222 [mobile] => 333 [email] => yourhoast@hotmail.com [fax] => 444 [address1] => somewhere1 [address2] => somewhere2 [suburb] => somewhere3 [state] => somewhere4 [postcode] => somewhere5 [registeredon] => 2002-08-30 14:58:42 [_DB_DataObject_version] => 1.0 [N] => 1 [_database_dsn] => [_database_dsn_md5] => ae07522950ca1af18e019b3935f14214 [_database] => auscarts [_condition] => [_group_by] => [_order_by] => [_limit] => [_data_select] => * [_DB_resultid] => 1 [_link_loaded] => [_lastError] => ) ) seems to be linking to itself or something like that... can you please show me what im doing wrong
From: Alan Knowles <alan@akbkhome.com> To: yourhoast@hotmail.com CC: pear-general@lists.php.net Subject: [PEAR] Re: DB_DataObject Date: Sun, 01 Sep 2002 09:26:38 +0800
Subject: DB_DataObject From: ".. .." <yourhoast@hotmail.com> Date: Sat, 31 Aug 2002 14:45:34 +0000 Hey ... just wondering if anyone can show some more detailed eg of linking tables with the dataobject... the ones on the site im a little confused about... thanx
Article Table: id summary body writerid category (2 other tables person and grp exist) -------------------------------- a links.ini [article] writerid = person:id category = categories:id -------------------------------- $article = DataObjects_Article::staticGet(12); //say article 12 was written by person 4 and has a category of 6 $article->getLinks(); will effectively do $article->_writerid = DataObjects_Person::staticGet('id',4); $article->_category = DataObjects_Categories::staticGet('id',6); Regards Alan
_________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com
-- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com


« previous php.pear.general (#2225) next »