I believe this issue is now fixed in revision 6332.  Todd, can you
please update and test your application?

Regards,
Bill Karwin 

> -----Original Message-----
> From: Bill Karwin [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 12, 2007 11:17 AM
> To: Zend Framework
> Subject: RE: [fw-general] Zend_DB findManyToManyRowset issue 
> in latest snapshot (after commit 6251)
> 
> My apologies.  It's so ingrained in me that it is a best practice to
> *never* name a primary key column "id" and *always* name a 
> foreign key column the same as the primary key column it 
> references that I failed to have a test case for the way most 
> people do it.
> 
> The reason the above is a best practice is that it gives you 
> the opportunity to use the USING or NATURAL join syntax 
> forms.  If you name all your primary keys "id" then you are 
> much less likely to be able to use these syntax forms.
> 
> Regards,
> Bill Karwin
> 
> > -----Original Message-----
> > From: Todd Wolaver [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, September 12, 2007 6:40 AM
> > To: Zend Framework
> > Subject: [fw-general] Zend_DB findManyToManyRowset issue in latest 
> > snapshot (after commit 6251)
> > 
> > Hello,
> > 
> > I just checked out the latest code from Trunk and now I'm getting 
> > errors within my application related to Zend_DB and 
> > findManyToManyRowset.  I've tried the samples in the documentation, 
> > http://framework.zend.com/manual/en/zend.db.table.relationship
> > s.html   
> > The sample code works.  However... with a slight change in column 
> > names it hoses the references.
> > 
> > The error:
> > Notice: Undefined index:  product_id in /srv/sites/athweb-prt03/ 
> > library/Zend/Db/Table/Row/Abstract.php on line 839
> > 
> > When calling findManyToManyRowset the name of the column in 
> the lookup 
> > table now has to be the same as the column name in the intersection 
> > table.  You used to be able to specify any column names 
> here, however 
> > commit #6251 changed this.  All of my tables have a column 
> of "id" as 
> > the primary key.
> > Intersection columns are named 'tablename_id'. Is there any way to 
> > keep this functionality or do I need to go back and change all my 
> > column names?
> > 
> > If I change the "id" column in both the products and bugs table to 
> > 'product_id' and 'bug_id' and make the corresponding changes in the 
> > referenceMap, findManyToManyRowset works.
> > 
> > Thanks,
> > Todd
> > 
> > The db structure that fails is:
> > CREATE TABLE `bugs` (
> >    `id` int(11) NOT NULL auto_increment PRIMARY KEY,  <--- 
> this would 
> > need to be bug_id to work
> >    `bug_description` varchar(100) default NULL,
> >    `bug_status` varchar(20) default NULL, );
> > 
> > 
> > CREATE TABLE `bugs_products` (
> >    `id` int(11) NOT NULL auto_increment PRIMARY KEY, <-- this would 
> > need to be product_id to work
> >    `bug_id` int(11) NOT NULL,
> >    `product_id` int(11) NOT NULL,
> > );
> > 
> > CREATE TABLE `products` (
> >    `id` int(11) NOT NULL auto_increment PRIMARY KEY,
> >    `product_name` varchar(100) default NULL, );
> > 
> > The referenceMap is:
> >      protected $_referenceMap    = array(
> >          'Bug' => array(
> >              'columns'           => array('bug_id'),
> >              'refTableClass'     => 'Bugs',
> >              'refColumns'        => array('id')  <--- this 
> > would need
> > to be bug_id to work
> >          ),
> >          'Product' => array(
> >              'columns'           => array('product_id'),
> >              'refTableClass'     => 'Products',
> >              'refColumns'        => array('id')  <--- this 
> > would need
> > to be product_id to work
> >          )
> >      );
> > 
> > 
> > 
> > 
> > 
> 

Reply via email to