Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $objectManager)
 {
     $datas = [['label' => 'Beginner', 'value' => 1, 'description' => 'I\'m in my learning phase.', 'type' => Level::TYPE_SKILL, 'enabled' => true], ['label' => 'Intermediate', 'description' => 'I can hold my own, but need a little help occasionally.', 'value' => 2, 'type' => Level::TYPE_SKILL, 'enabled' => true], ['label' => 'Advandced', 'description' => 'I\'m qualified and don\'t need any help from others. ', 'value' => 3, 'type' => Level::TYPE_SKILL, 'enabled' => true], ['label' => 'Expert', 'description' => 'My co-workers or my contacts regularly ask for my help.', 'value' => 4, 'type' => Level::TYPE_SKILL, 'enabled' => true], ['label' => 'Beginner', 'value' => 1, 'description' => 'I can reply to a few simple questions.', 'type' => Level::TYPE_LANGUAGE, 'enabled' => true], ['label' => 'Intermediate', 'value' => 2, 'description' => 'I can hold a conversation on a familiar subject and discuss a project or ideas.', 'type' => Level::TYPE_LANGUAGE, 'enabled' => true], ['label' => 'Fluent', 'value' => 3, 'description' => 'I easily hold business conversations and write elaborate documents.', 'type' => Level::TYPE_LANGUAGE, 'enabled' => true], ['label' => 'Bilingual', 'value' => 4, 'description' => 'I easily switch from one language to another.', 'type' => Level::TYPE_LANGUAGE, 'enabled' => true], ['label' => 'Native', 'value' => 5, 'description' => 'It is my mother tongue.', 'type' => Level::TYPE_LANGUAGE, 'enabled' => true]];
     foreach ($datas as $data) {
         $level = new Level();
         $level->setLabel($data['label']);
         $level->setDescription($data['description']);
         $level->setValue($data['value']);
         $level->setType($data['type']);
         $level->setEnabled($data['enabled']);
         $objectManager->persist($level);
         $objectManager->flush();
     }
 }
Exemplo n.º 2
0
 /**
  * @param FormMapper $formMapper
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->add('label')->add('description', null, ['required' => false])->add('value')->add('type', 'choice', ['choices' => Level::getConstants()])->add('enabled', null, ['required' => false]);
 }