Data Object database.links.ini problem
| From: | (PHPDiscuss - PHP Newsgroups and mailing lists) | Date: | Tue, 25 Jan 2005 08:20:57 +0000 |
| Subject: | Data Object database.links.ini problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17144@lists.php.net to get a copy of this message | ||
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 ...) ?
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 ???
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