/**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('mrn', 'text', array('label' => 'accard.patient.form.mrn', 'required' => false))->add('firstName', 'text', array('label' => 'accard.patient.form.first_name', 'required' => true))->add('lastName', 'text', array('label' => 'accard.patient.form.last_name', 'required' => true))->add('dateOfBirth', 'birthday', array('label' => 'accard.patient.form.date_of_birth', 'required' => true))->add('dateOfDeath', 'date', array('label' => 'accard.patient.form.date_of_death', 'required' => false))->add('gender', 'choice', array('label' => 'accard.patient.form.gender', 'required' => true, 'placeholder' => 'accard.patient.action.choose_gender', 'choices' => $this->prepareChoices(Patient::getAvailableGenders(), 'gender')))->add('race', 'choice', array('label' => 'accard.patient.form.race', 'required' => true, 'placeholder' => 'accard.patient.action.choose_race', 'choices' => $this->prepareChoices(Patient::getAvailableRaces(), 'race')))->add('fields', 'collection', array('required' => false, 'type' => 'accard_patient_field_value', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false))->addEventSubscriber(new DefaultPatientFieldListener($builder->getFormFactory(), $this->patientBuilder));
     if ($options['use_phases']) {
         $builder->add('phases', 'collection', array('required' => false, 'type' => 'accard_patient_phase_instance', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'options' => array('use_target' => false)));
     }
 }
Example #2
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->createdAt = new DateTime();
     $this->diagnoses = new ArrayCollection();
     $this->activities = new ArrayCollection();
     $this->behaviors = new ArrayCollection();
     $this->attributes = new ArrayCollection();
     $this->phases = new ArrayCollection();
     $this->regimens = new ArrayCollection();
     $this->samples = new ArrayCollection();
     parent::__construct();
 }
 public function testPatientDefinesAvailableRaces()
 {
     $this->assertInternalType('array', Patient::getAvailableRaces());
     $this->assertGreaterThan(0, count(Patient::getAvailableRaces()));
 }