Hi all,

I am facing an issue. Hope you can point me in the right direction.

In my db the STUDENT table has a relation 1 to 1 with the UNIVERSITY
table.
On the other hand, the FACULTY table has a relation many to 1 with
UNIVERSITY.

The BaseStudentForm.php generated by
“php symfony doctrine:generate-module --with-show --non-verbose-
templates frontend estudiante Student” command, configures the form
as:

<?php

abstract class BaseStudentForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'est_cod'        => new sfWidgetFormInputHidden(),
      'uni_cod'        => new sfWidgetFormDoctrineChoice(array('model'
=>
    $this->getRelatedModelName('University'), 'add_empty' => false)),
      'fac_cod'        => new sfWidgetFormInputText(),
     …

    ));

Student class is
<?php
class Student extends BaseEstudianteEst
{
}

And that's why the field for the FACULTY shows as a free text field
instead of a select box with all faculties.
I wonder what kind of modification can I implement in the
BaseStudentForm or Student class so a select box gets populated with
faculties as options.

If required, this is my schema.yml for those tables.

Thanks in advance,
Peter

Student:
  connection: doctrine
  tableName: student
  columns:
     st_cod:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: true
      autoincrement: true
    uni_cod:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: false
      default: '0'
      notnull: true
      autoincrement: false
    fac_cod:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: false
      default: '0'
      notnull: true
      autoincrement: false
     relations:
     University:
       local: uni_cod
       foreign: uni_cod
       type: one
University:
  connection: doctrine
  tableName: university
  columns:
    uni_cod:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: true
      autoincrement: true
    uni_name:
      type: string()
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  relations:
    Student:
      local: uni_cod
      foreign: uni_cod
      type: many
    Faculty:
      local: uni_cod
      foreign: uni_cod
      type: many
Faculty:
  connection: doctrine
  tableName: faculty
  columns:
    fac_cod:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: true
      autoincrement: true
    uni_cod:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: false
      default: '0'
      notnull: true
      autoincrement: false
    fac_name:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    University:
      local: uni_cod
      foreign: uni_cod
      type: one


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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