On Tue, Mar 2, 2010 at 4:46 AM, Nicolas Grevet <[email protected]> wrote:
> Seeing the lack of interest our problem seems to raise, I guess that either
> no one cares at all or no one ever used the intersecting fields on a many to
> many relationship with ZF (makes me wonder which one is the worst case
> scenario).
>
> Jurian Sluiman wrote:
>>
>> I came upon this issue as well. I have a table users (id, name, passwd),
>> profile_fields (id, name) and profile_field_values which is an intersecting
>> table (user_id, field_id, value).
>>
>> Now all my values of profile fields are lost. Apparently no unit test
>> provides this use case so the BC break wasn't noticed? How am I able to have
>> my profile fields back?
>>
>> Thanks,
>> Jurian
>

Looks like we have two sides on this.  Here are a couple of issues related.
Short version: findManyToManyRowset should not contain extra columns.

http://framework.zend.com/issues/browse/ZF-6232
 findManyToManyRowset() returns columns from the intersection table

http://framework.zend.com/issues/browse/ZF-3709
 Inconsistent behaviour in Zend_Db_Table and supporting classes

Unit tests were added to match the documented behavior.  The extra
columns, as per documentation, were a quirk. There are also a few
cases that the unexpected columns break things. Specifically
triggering the throw:

Row/Abstract.php:
throw new Zend_Db_Table_Row_Exception('The specified Table does not
have the same columns as the Row');

As for getting the profile columns back, this should be helpful:
$select = $db->select()
->from($profileFieldsTableName, array('name'))
->joinInner($profileValuesTableName, 'id=field_id', array('field_id', 'value'))
->where('user_id=?', $user->id);
$profileValues = $db->fetchAll($select);

Reply via email to