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.relationships.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
)
);