コード例 #1
0
 /**
  * A convenience method for embedding collections.
  * 
  * @param BaseFormDoctrine $form
  * @param string $formName
  * @param string $relationAlias
  * @param array $options
  * @return void
  */
 private static function embedCollection(BaseFormDoctrine $form, $formName, $relationAlias, array $options)
 {
     // set required options
     $options['parent_object'] = $form->getObject();
     $options['relation_alias'] = $relationAlias;
     // initialize and embed the collection form
     $collectionForm = new jmsBaseCollectionForm(array(), $options);
     $form->embedForm($formName, $collectionForm);
 }
コード例 #2
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'country_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Country'), 'add_empty' => false)),
      'code'       => new sfWidgetFormInputText(),
      'name'       => new sfWidgetFormInputText(),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'country_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Country'))),
      'code'       => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'name'       => new sfValidatorString(array('max_length' => 64)),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('showmobile_zone[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #3
0
 protected function doSave($con = null)
 {
     $this->saveGroupsList($con);
     $this->savePermissionsList($con);
     $this->saveTypesList($con);
     parent::doSave($con);
 }
  public function setup()
  {
    $this->setWidgets(array(
      'id'                    => new sfWidgetFormInputHidden(),
      'mailinglistversion_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MailinglistVersion'), 'add_empty' => true)),
      'type'                  => new sfWidgetFormInputText(),
      'deleteworkflow'        => new sfWidgetFormInputText(),
      'archiveworkflow'       => new sfWidgetFormInputText(),
      'stopneworkflow'        => new sfWidgetFormInputText(),
      'detailsworkflow'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                    => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'mailinglistversion_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('MailinglistVersion'), 'required' => false)),
      'type'                  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'deleteworkflow'        => new sfValidatorInteger(array('required' => false)),
      'archiveworkflow'       => new sfValidatorInteger(array('required' => false)),
      'stopneworkflow'        => new sfValidatorInteger(array('required' => false)),
      'detailsworkflow'       => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('mailinglist_authorization_setting[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #5
0
  public function setup()
  {
    $this->setWidgets(array(
      'non_psycho_pat_id' => new sfWidgetFormInputHidden(),
      'ad_patient_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AdPatient'), 'add_empty' => false)),
      'non_psycho_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AdNonPsycho'), 'add_empty' => false)),
      'start_date'        => new sfWidgetFormDateTime(),
      'stop_date'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'non_psycho_pat_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('non_psycho_pat_id')), 'empty_value' => $this->getObject()->get('non_psycho_pat_id'), 'required' => false)),
      'ad_patient_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AdPatient'))),
      'non_psycho_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AdNonPsycho'))),
      'start_date'        => new sfValidatorDateTime(),
      'stop_date'         => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ad_non_psycho_pat[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #6
0
 protected function doSave($con = null)
 {
     $this->saveAlbumsList($con);
     $this->savePhotosList($con);
     $this->saveEventList($con);
     parent::doSave($con);
 }
コード例 #7
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'reason'     => new sfWidgetFormTextarea(),
      'referer'    => new sfWidgetFormInputText(),
      'state'      => new sfWidgetFormChoice(array('choices' => array('valid' => 'valid', 'invalid' => 'invalid', 'untreated' => 'untreated'))),
      'id_comment' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Comment'), 'add_empty' => false)),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'reason'     => new sfValidatorString(),
      'referer'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'state'      => new sfValidatorChoice(array('choices' => array(0 => 'valid', 1 => 'invalid', 2 => 'untreated'), 'required' => false)),
      'id_comment' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Comment'))),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('comment_report[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'class_letter_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ClassLetter'), 'add_empty' => false)),
      'person_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Person'), 'add_empty' => false)),
      'enrolment_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Enrolment'), 'add_empty' => true)),
      'sent_at'         => new sfWidgetFormDateTime(),
      'success'         => new sfWidgetFormInputCheckbox(),
      'failed'          => new sfWidgetFormInputCheckbox(),
      'email'           => new sfWidgetFormInputText(),
      'body'            => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'class_letter_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ClassLetter'))),
      'person_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Person'))),
      'enrolment_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Enrolment'), 'required' => false)),
      'sent_at'         => new sfValidatorDateTime(),
      'success'         => new sfValidatorBoolean(array('required' => false)),
      'failed'          => new sfValidatorBoolean(array('required' => false)),
      'email'           => new sfValidatorEmail(array('max_length' => 255, 'required' => false)),
      'body'            => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ds_class_letter_recipient[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #9
0
 protected function doSave($con = null)
 {
     $this->savegroupsList($con);
     $this->savepermissionsList($con);
     $this->saveSkinnyChecksList($con);
     parent::doSave($con);
 }
コード例 #10
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'address_format'  => new sfWidgetFormInputText(),
      'address_summary' => new sfWidgetFormInputText(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'address_format'  => new sfValidatorString(array('max_length' => 128)),
      'address_summary' => new sfValidatorString(array('max_length' => 48, 'required' => false)),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('showmobile_address_format[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #11
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'name'       => new sfWidgetFormInputText(),
      'city'       => new sfWidgetFormInputText(),
      'state'      => new sfWidgetFormInputText(),
      'zip'        => new sfWidgetFormInputText(),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'city'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'state'      => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'zip'        => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('company[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #12
0
 protected function doSave($con = null)
 {
     $this->saveConnectedProductsList($con);
     $this->saveParameterOptionsList($con);
     $this->saveProductOrderList($con);
     parent::doSave($con);
 }
コード例 #13
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'title'          => new sfWidgetFormInputText(),
      'type'           => new sfWidgetFormInputText(),
      'writeprotected' => new sfWidgetFormInputText(),
      'color'          => new sfWidgetFormInputText(),
      'deleted_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'title'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'type'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'writeprotected' => new sfValidatorInteger(array('required' => false)),
      'color'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'deleted_at'     => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('field[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #14
0
 protected function doSave($con = null)
 {
     $this->savegroupsList($con);
     $this->savepermissionsList($con);
     $this->saveproceduresList($con);
     parent::doSave($con);
 }
コード例 #15
0
  public function setup()
  {
    $this->setWidgets(array(
      'notification_id' => new sfWidgetFormInputHidden(),
      'prev_user_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AdUser_3'), 'add_empty' => false)),
      'new_user_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AdUser'), 'add_empty' => false)),
      'patient_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AdPatient'), 'add_empty' => false)),
      'reason'          => new sfWidgetFormTextarea(),
      'accepted'        => new sfWidgetFormInputText(),
      'checked'         => new sfWidgetFormInputText(),
      'date'            => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'notification_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('notification_id')), 'empty_value' => $this->getObject()->get('notification_id'), 'required' => false)),
      'prev_user_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AdUser_3'))),
      'new_user_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AdUser'))),
      'patient_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AdPatient'))),
      'reason'          => new sfValidatorString(array('required' => false)),
      'accepted'        => new sfValidatorInteger(array('required' => false)),
      'checked'         => new sfValidatorInteger(array('required' => false)),
      'date'            => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('ad_notification[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #16
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'user_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'driver_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Driver'), 'add_empty' => false)),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'user_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'driver_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Driver'))),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('showmobile_passenger[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #17
0
 protected function doSave($con = null)
 {
     $this->saveTagsList($con);
     $this->saveAuthorsList($con);
     $this->saveRatersList($con);
     parent::doSave($con);
 }
コード例 #18
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'       => new sfWidgetFormInputHidden(),
      'field_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Field'), 'add_empty' => true)),
      'value'    => new sfWidgetFormInputText(),
      'isactive' => new sfWidgetFormInputText(),
      'position' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'       => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'field_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Field'), 'required' => false)),
      'value'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'isactive' => new sfValidatorInteger(array('required' => false)),
      'position' => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('field_radiogroup[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #19
0
 protected function doSave($con = null)
 {
     $this->saveMoviesList($con);
     $this->saveChaptersList($con);
     $this->saveEpisodesList($con);
     parent::doSave($con);
 }
  protected function doSave($con = null)
  {
    $this->saveListsList($con);
    $this->saveMessagesList($con);

    parent::doSave($con);
  }
コード例 #21
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'studio_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Studio'), 'add_empty' => false)),
      'weekday'    => new sfWidgetFormChoice(array('choices' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7))),
      'time'       => new sfWidgetFormTime(),
      'duration'   => new sfWidgetFormInputText(),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
      'created_by' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'add_empty' => false)),
      'updated_by' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'studio_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Studio'))),
      'weekday'    => new sfValidatorChoice(array('choices' => array(0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7), 'required' => false)),
      'time'       => new sfValidatorTime(array('required' => false)),
      'duration'   => new sfValidatorInteger(array('required' => false)),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
      'created_by' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'))),
      'updated_by' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ds_slot[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #22
0
  public function setup()
  {
    $this->setWidgets(array(
      'med_base_id' => new sfWidgetFormInputHidden(),
      'mainclass'   => new sfWidgetFormInputText(),
      'gen_name'    => new sfWidgetFormInputText(),
      'speciality'  => new sfWidgetFormInputText(),
      'med_type_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MedType'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'med_base_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('med_base_id')), 'empty_value' => $this->getObject()->get('med_base_id'), 'required' => false)),
      'mainclass'   => new sfValidatorString(array('max_length' => 45)),
      'gen_name'    => new sfValidatorString(array('max_length' => 45)),
      'speciality'  => new sfValidatorString(array('max_length' => 45)),
      'med_type_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('MedType'))),
    ));

    $this->widgetSchema->setNameFormat('med_base_id[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #23
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'joined_at'          => new sfWidgetFormDate(),
      'membership_type_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MembershipType'), 'add_empty' => false)),
      'person_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Profile'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'joined_at'          => new sfValidatorDate(),
      'membership_type_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('MembershipType'))),
      'person_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Profile'))),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'dsMember', 'column' => array('person_id')))
    );

    $this->widgetSchema->setNameFormat('ds_member[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #24
0
  protected function doSave($con = null)
  {
    $this->saveUsersList($con);
    $this->savePermissionsList($con);

    parent::doSave($con);
  }
コード例 #25
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'name'       => new sfWidgetFormInputText(),
      'is_primary' => new sfWidgetFormInputCheckbox(),
      'city'       => new sfWidgetFormInputText(),
      'state'      => new sfWidgetFormInputText(),
      'zip'        => new sfWidgetFormInputText(),
      'contact_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'add_empty' => false)),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'is_primary' => new sfValidatorBoolean(array('required' => false)),
      'city'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'state'      => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'zip'        => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'contact_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'))),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('contact_address[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #26
0
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'lesson_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Lesson'), 'add_empty' => false)),
      'class_student_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Student'), 'add_empty' => false)),
      'will_attend'      => new sfWidgetFormInputCheckbox(),
      'was_present'      => new sfWidgetFormInputCheckbox(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'lesson_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Lesson'))),
      'class_student_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Student'))),
      'will_attend'      => new sfValidatorBoolean(array('required' => false)),
      'was_present'      => new sfValidatorBoolean(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'dsLessonStudent', 'column' => array('lesson_id', 'class_student_id')))
    );

    $this->widgetSchema->setNameFormat('ds_lesson_student[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
コード例 #27
0
 /**
  *
  */
 protected function doBind(array $values)
 {
     $values['id'] = $this->getObject()->getId();
     // это поле всегда лишнее
     if (array_key_exists('password_repeat', $values)) {
         unset($values['password_repeat']);
     }
     // эту х-ню делать в модели
     if (isset($values['user_service_mail']) && !empty($values['user_service_mail'])) {
         $values['user_service_mail'] = $values['user_service_mail'] . '@mail.easyfinance.ru';
     }
     parent::doBind($values);
     // не обновлять e-mail если идентичен или когда не введен пароль
     if (isset($this->values['user_mail']) && !empty($this->values['user_mail']) && $this->getObject()->getUserMail() != $this->values['user_mail']) {
         if (!isset($this->values['password']) || empty($this->values['password'])) {
             unset($this->values['user_mail'], $this['user_mail'], $this->values['password']);
         }
     }
     // обновить пароль, если задан новый (и не пустой) и старый
     if (isset($this->values['password']) && !empty($this->values['password']) && isset($this->values['password_new']) && !empty($this->values['password_new'])) {
         $this->values['password'] = $this->values['password_new'];
         unset($this->values['password_new'], $this['password_new']);
         // не трогать пароль без необходимости
     } else {
         unset($this->values['password'], $this->values['password_new'], $this['password'], $this['password_new']);
     }
     return $values;
 }
コード例 #28
0
 protected function doSave($con = null)
 {
     $this->saveGroupsList($con);
     $this->savePermissionsList($con);
     $this->saveNjNotificationsSubscribedList($con);
     parent::doSave($con);
 }
コード例 #29
0
  public function setup()
  {
    $this->setWidgets(array(
      'id_traitement_agent' => new sfWidgetFormInputHidden(),
      'commentaire_agent'   => new sfWidgetFormInputText(),
      'id_qualif_agent'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('QualificationAgent'), 'add_empty' => true)),
      'id_question'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Question'), 'add_empty' => false)),
      'id_agent'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Utilisateur'), 'add_empty' => true)),
      'priorite'            => new sfWidgetFormInputText(),
      'date_creation'       => new sfWidgetFormDateTime(),
      'date_modification'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id_traitement_agent' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_traitement_agent')), 'empty_value' => $this->getObject()->get('id_traitement_agent'), 'required' => false)),
      'commentaire_agent'   => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'id_qualif_agent'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('QualificationAgent'), 'required' => false)),
      'id_question'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Question'))),
      'id_agent'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Utilisateur'), 'required' => false)),
      'priorite'            => new sfValidatorInteger(array('required' => false)),
      'date_creation'       => new sfValidatorDateTime(),
      'date_modification'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('traitement_agent[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }
  public function setup()
  {
    $this->setWidgets(array(
      'id'                    => new sfWidgetFormInputHidden(),
      'workflowslotfield_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('WorkflowSlotField'), 'add_empty' => true)),
      'fieldcheckboxgroup_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FieldCheckboxgroup'), 'add_empty' => true)),
      'value'                 => new sfWidgetFormInputText(),
      'position'              => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                    => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'workflowslotfield_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('WorkflowSlotField'), 'required' => false)),
      'fieldcheckboxgroup_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('FieldCheckboxgroup'), 'required' => false)),
      'value'                 => new sfValidatorInteger(array('required' => false)),
      'position'              => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('workflow_slot_field_checkboxgroup[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }