This is worrisome. I'm setting up a site to manage the teams in high
school basketball tournament in Florida. I've got two database tables:

  new_game:
    _attributes: { idMethod: native }
    id: { type: INTEGER, required: true, autoIncrement: true,
primaryKey: true }
    location: { type: INTEGER, foreignTable: new_location,
foreignReference: id, required: true, default: '' }
    date: { type: TIMESTAMP, default: '' }
    team1: { type: INTEGER, foreignTable: new_team, foreignReference:
id, required: true, default: '' }
    team2: { type: INTEGER, foreignTable: new_team, foreignReference:
id, required: true, default: '' }
    team1_score: { type: INTEGER, default: '' }
    team2_score: { type: INTEGER, default: '' }


  new_team:
    _attributes: { idMethod: native }
    id: { type: INTEGER, required: true, autoIncrement: true,
primaryKey: true }
    teamname: { type: VARCHAR, size: '255' }
    teamnumber: { type: INTEGER }
    type: { type: VARCHAR, size: '255', required: true, default: '' }


So, as you can see, the game table is suppose to have two fields that
point to the team table. In the form class, both of these are set up
as drop down select boxes:

    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'location'    => new sfWidgetFormInput(),
      'date'        => new sfWidgetFormInput(),
      'team1'       => new sfWidgetFormPropelSelect(array('model' =>
'NewTeam', 'add_empty' => false)),
      'team2'       => new sfWidgetFormPropelSelect(array('model' =>
'NewTeam', 'add_empty' => false)),
      'team1_score' => new sfWidgetFormInput(),
      'team2_score' => new sfWidgetFormInput(),
    ));

Please note that I'm using Symfony 1.1, so some of the form widgets
from 1.2 are not available to me.

The game table is not showing the current values in the select boxes.
Is this normal behavior? Seems like a bug. For instance, I've one
entry where team1 has a value of 55, and team2 has a value of 145. I
implemented the __toString method in NewTeam, so that the user can see
the names of the teams:

  public function __toString()
  {
        $locationList = NewLocationPeer::doSelect(new Criteria());
    $arrayOfLocations = array();

    foreach ($locationList as $location):
                $id = $location->getId();
                $name = $location->getName();

                $arrayOfLocations[$id] = $name;
    endforeach;

    return $arrayOfLocations;
  }

Is this the correct way to implement the __toString method? I could
not find an example of how to do this in the docs.

When I'm creating a new entry in the game table, all works well. The
two drop down select boxes give me a list of all the teams. I choose
the names of the 2 teams who are playing the game, and then the ids
for those teams are put in the database. But when I'm editing an
existing entry, the drop down boxes don't show the current values.

For instance, in one entry, the two teams are these:

6th Man Club
The Beacon Group

But in the drop down select boxes, I only see the first team which
always appears:

The Carters
The Carters

What is going on here?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to