Re: Re: dataObject multiple links from a column
| From: | Alan Knowles | Date: | Wed, 21 Jan 2004 09:08:36 +0000 |
| Subject: | Re: Re: dataObject multiple links from a column | ||
| References: | 1 2 3 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-10261@lists.php.net to get a copy of this message | ||
your could always try setting up the links manually before sending : eg..
$do->links(
array('car_id.partnum' => 'part_numbers:car_id')
);
or writing the method links in the extended class - and returning the correct array.
Regards
Alan
Didier Galland wrote:
mysql says that 'marker_category_xref.marker_id' = unknow table in clause on. Same thing by following your advice. I think the problem is more related to multiple links in dbname.links.ini. Example given in doc :-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com; for a sales example with multiple links of a singlecolumn [sales]; for autoloading the car object into $sales->_car_idcar_id = car:id; for autoloading the part number object into$sales->_car_id_partnum car_id.partnum = part_numbers:car_id The last line doesn't works for me : It seems that the full stop in dbname.links.ini is not correctly parsed and sent as it to mysql (marker_id.smc = marker_commercial_smc:marker_id in [marker_category_xref] section), so mysql complains because of the "marker_category_xref.marker_id.smc" reference in on clause (the table doesn't exists). If I change my dbname.links.ini and add marker_id = marker_commercial_smc:marker_id in [marker_category_xref] section (in last place), all goes right for this query BUT I need two links and only the last one can be taken : [marker_category_xref] marker_id = marker:marker_id ;this line make my query working, but override the above... and break other queries ;if I comment it, of course debug says me : ERROR: joinAdd: marker_category_xref hasno link with marker_commercial_smc marker_id = marker_commercial_smc:marker_id Thanks for your help. Regards, Didier ----- Original Message ----- From: "Alan Knowles" <alan@akbkhome.com> To: "Didier Galland" <listsdg@appli-box.com> Cc: "PEAR general list" <pear-general@lists.php.net> Sent: Sunday, January 11, 2004 1:06 PM Subject: [PEAR] Re: dataObject multiple links from a columnmarker_category_xref ON__find: SENT: SELECT * FROM marker_commercial_smc INNER JOINmarker_category_xref.marker_id.smc=marker_commercial_smc.marker_id WHERE marker_category_xref.category_id = '2f8edc5e7dc6a65839672545d7ff3a43' ERROR: DB Error: unknown errorThis is pretty common when using joins... use the mysql command prompt and paste the query into it.. (to see the real error) - I suspect it will say ambiguos result.. - eg. two columns the same.. In which case it may be worth using $mcx->category_id = $category_id; $mcs->joinAdd($mcx); // select as the same name.. $mcs->selectAs(); // select all the mcx fields as mcx_* $mcs->selectAs($mcs,'mcx_%s');