コード例 #1
0
 /**
  * @Given /^employee "([^"]*)" "([^"]*)" used "([^"]*)" vacation days$/
  */
 public function employeeUsedVacationDays($fname, $lname, $days)
 {
     $em = $this->get('em');
     $employee = $em->getRepository('AppBundle:Employee')->findOneBy(['firstname' => $fname, 'lastname' => $lname]);
     $vacation = new Vacation();
     $starts = $employee->getJoinedAt();
     $ends = clone $starts;
     $ends->modify('+' . $days . ' days');
     $vacation->setStartsAt($starts);
     $vacation->setEndsAt($ends);
     $vacation->setEmployee($employee);
     $employee->addVacation($vacation);
     $em->persist($employee);
     $em->flush();
 }
コード例 #2
0
ファイル: VacationAdmin.php プロジェクト: Nexotap/Ivory
 protected function configureFormFields(FormMapper $formMapper)
 {
     $subject = $this->getSubject();
     // TODO Nexo: Wait for the new version of sonata-admin, where box_class is working
     $formMapper->with('', array('class' => 'col-md-8', 'box_class' => 'box box-solid box-danger', 'description' => 'Wichtig!!! Sonn- und allgemeine Feiertage werden momentan nicht berücksichtig.
     Nur die effektiven Arbeitstage als Ferientage verbuchen. Nötigenfalls zwei Eintrage machen.'));
     if (!$this->isChild()) {
         $formMapper->add('employee', 'sonata_type_model', array('btn_add' => false));
     }
     $formMapper->add('startDate', 'date', array('label' => 'first_day', 'widget' => 'single_text'))->add('endDate', 'date', array('label' => 'last_day', 'widget' => 'single_text'))->add('startDateHalfDay', null, array('label' => 'only_half_day'))->add('endDateHalfDay', null, array('label' => 'only_half_day'))->add('state', 'choice', array('choices' => Vacation::getStateChoices(), 'placeholder' => 'choose_status', 'empty_data' => null))->add('comment', 'textarea', array('required' => false))->end();
 }