| Conditions | 1 |
| Paths | 1 |
| Total Lines | 75 |
| Code Lines | 58 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 28 | protected function configureFormFields(FormMapper $formMapper) |
||
| 29 | { |
||
| 30 | $localsRequiredService = $this->getConfigurationPool()->getContainer()->get('application_default.sonata.locales.required'); |
||
| 31 | $localOptions = $localsRequiredService->getLocalsRequiredArray(); |
||
| 32 | $formMapper |
||
| 33 | ->with('Переводы') |
||
| 34 | ->add('translations', 'a2lix_translations_gedmo', [ |
||
| 35 | 'translatable_class' => $this->getClass(), |
||
| 36 | 'fields' => [ |
||
| 37 | 'name' => [ |
||
| 38 | 'label' => 'Имя', |
||
| 39 | 'locale_options' => $localOptions, |
||
| 40 | ], |
||
| 41 | 'about' => [ |
||
| 42 | 'label' => 'Описание', |
||
| 43 | 'locale_options' => $localOptions, |
||
| 44 | ], |
||
| 45 | ], |
||
| 46 | ]) |
||
| 47 | ->end() |
||
| 48 | ->with('Общие') |
||
| 49 | ->add('slug') |
||
| 50 | ->add('email') |
||
| 51 | ->add('company', null, ['label' => 'Место работы']) |
||
| 52 | ->add('sortOrder', null, ['label' => 'Номер сортировки']) |
||
| 53 | // @todo rm array options https://github.com/dustin10/VichUploaderBundle/issues/27 and https://github.com/symfony/symfony/pull/5028 |
||
| 54 | ->add('file', 'file', [ |
||
| 55 | 'required' => false, |
||
| 56 | 'data_class' => 'Symfony\Component\HttpFoundation\File\File', |
||
| 57 | 'property_path' => 'file', |
||
| 58 | 'label' => 'Фото', |
||
| 59 | ]) |
||
| 60 | ->end() |
||
| 61 | ->with('Участвует в событиях', ['class' => 'col-md-4']) |
||
| 62 | ->add('events', 'entity', [ |
||
| 63 | 'class' => 'Stfalcon\Bundle\EventBundle\Entity\Event', |
||
| 64 | 'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) { |
||
| 65 | $qb = $repository->createQueryBuilder('e'); |
||
| 66 | $repository = $qb->orderBy('e.id', 'DESC'); |
||
| 67 | |||
| 68 | return $repository; |
||
| 69 | }, |
||
| 70 | 'multiple' => true, |
||
| 71 | 'expanded' => true, |
||
| 72 | 'label' => 'События', |
||
| 73 | ]) |
||
| 74 | ->end() |
||
| 75 | ->with('Кандидат на события', ['class' => 'col-md-4']) |
||
| 76 | ->add('candidateEvents', 'entity', [ |
||
| 77 | 'class' => 'Stfalcon\Bundle\EventBundle\Entity\Event', |
||
| 78 | 'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) { |
||
| 79 | $qb = $repository->createQueryBuilder('e'); |
||
| 80 | $repository = $qb->orderBy('e.id', 'DESC'); |
||
| 81 | |||
| 82 | return $repository; |
||
| 83 | }, |
||
| 84 | 'multiple' => true, |
||
| 85 | 'expanded' => true, |
||
| 86 | 'label' => 'События', |
||
| 87 | ]) |
||
| 88 | ->end() |
||
| 89 | ->with('Программный комитет', ['class' => 'col-md-4']) |
||
| 90 | ->add('committeeEvents', 'entity', [ |
||
| 91 | 'class' => 'Stfalcon\Bundle\EventBundle\Entity\Event', |
||
| 92 | 'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) { |
||
| 93 | $qb = $repository->createQueryBuilder('e'); |
||
| 94 | $repository = $qb->orderBy('e.id', 'DESC'); |
||
| 95 | |||
| 96 | return $repository; |
||
| 97 | }, |
||
| 98 | 'multiple' => true, |
||
| 99 | 'expanded' => true, |
||
| 100 | 'label' => 'События', |
||
| 101 | ]) |
||
| 102 | ->end() |
||
| 103 | ; |
||
| 106 |