Re: Data Object database.links.ini problem

From: Date: Thu, 27 Jan 2005 17:11:28 +0000
Subject: Re: Data Object database.links.ini problem
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17213@lists.php.net to get a copy of this message
On 27 Jan 2005 09:37:03 -0000, PHPDiscuss - PHP Newsgroups and mailing lists <dumont.jp@free.fr> wrote: > Justin Patrin wrote: > > > On 25 Jan 2005 08:20:57 -0000, PHPDiscuss - PHP Newsgroups and mailing > > lists <dumont.jp@free.fr> wrote: > > > I've got some problems with my yourDatabaseName.links.ini file. I did > > > work it once but since i moved this file in a relative path using a php > > > require > > > on my script (in the same folder with the generated table classes) the > > > getlinks or joinadd methods just don't work and even with debug on and > > > using > > > print_r($GLOBALS['_DB_DATAOBJECT']['LINKS']); > > > seems that this file is not found... > > > > > > Questions : > > > > > > 1-Do we need to have our db with innodb on and make explicit and physical > > > links between tables (I think not but we never know ...) ? > > > No. > > > > 2-Where do i put the DatabaseName.links.ini file ? I've done an php > > > include of a my script with the DO parameters in it. I've also tried the > > > dataobject.ini file with parse_ini_file ans an absolute path. > > > This DO parameters script is in the same folder of the generated table > > > classes. Logically i put the DatabaseName.links.ini file here as > > > mentionned in the doc. > > > BUT we never get a reference of this file in our script ??? > > > > > > It goes in the same place as your database.ini file, which is the > > schema_location in your DataObject.ini file. DB_DO loads this > > automatically. > > > > 3-After parameting the DatabaseName.links.ini file (the syntax is easy > > > with a 1:n relationship) > > > ********* > > > [tableA] > > > tableA__fk_B = tableB:tableB__id_B > > > ********* > > > > > > After including ALL the table classes and the DO parameters > > > if i use the getlinks method, i have this : > > > ************ > > > $objA = new DataObject_TableA; > > > $objA->find(); > > > while ($objA->fetch()) { > > > $objA->getLinks(); > > > echo "{$objA->_fk_B->id_B}"; > > > } > > > ************ > > > > > > Well, the joinadd method should be more simple. > > > ************ > > > $objA = new DataObject_TableA; > > > $objB = new DataObject_TableB; > > > > > > $objA->joinAdd($objB, 'LEFT'); //for left join > > > //using $objA with tableB fields in it > > > } > > > ************ > > > > > > Did i miss something ? Thx a lot for you help, > > > > > > JP.Dumont > > > > > Ok thx. > > But I just can't make it work. Is there a way to pointing on db.links.ini > file directly ? > And is there a way to show if the ini files are loaded correctly ? (i'll > look at the code). > thx > print_r($GLOBALS['_DB_DATAOBJECT']['LINKS']); If that outputs nothing it doesn't see your file. You can also try turning up DB_DO's debug level with: DB_DataObject::debugLevel(5); or a lower #, but I usually use 5 to see everything. Are you naming the file with the database name? If your database is named "foo" then your links file should be foo.links.ini. -- Justin Patrin

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