This enhancement allow developer to use different field (not primary key) as option value in object_select_tag.
1) Change at line 120
<?php
...
$text_method = _get_option($options, 'text_method');
$select_options = _get_options_from_objects(sfContext::getInstance()->retrieveObjects($related_class,
$peer_method), $text_method);
...
to
<?php
...
$text_method = _get_option($options, 'text_method');
$key_method = _get_option($options, 'key_method');
$select_options = _get_options_from_objects(sfContext::getInstance()->retrieveObjects($related_class,
$peer_method), $text_method, $key_method);
...
2) Change at line 155(151)
<?php
...
function _get_options_from_objects($objects, $text_method = null)
{
$select_options = array();
if ($objects)
{
$multi_primary_keys = is_array($objects[0]->getPrimaryKey()) ? true : false;
$methodToCall = '';
foreach (array($text_method, '__toString', 'toString', 'getPrimaryKey') as $method)
...
to
<?php
...
function _get_options_from_objects($objects, $text_method = null, $key_method = null)
{
$select_options = array();
if ($objects)
{
$getKeyMethod = ($key_method) ? $key_method : 'getPrimaryKey';
$multi_primary_keys = is_array($objects[0]->$getKeyMethod()) ? true : false;
$methodToCall = '';
foreach (array($text_method, '__toString', 'toString', $getKeyMethod) as $method)
...
3) Change at line 180(174)
<?php
...
$key = $multi_primary_keys ? implode('/', $tmp_object->getPrimaryKey()) : $tmp_object->getPrimaryKey();
...
to
<?php
...
$key = $multi_primary_keys ? implode('/', $tmp_object->$getKeyMethod()) : $tmp_object->$getKeyMethod();
...