<commit_before><?php

namespace Flowcode\ShopBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Amulen\ClassificationBundle\Entity\Tag;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;

class ProductType extends AbstractType
{

    private $categoryService;

    public function __construct($categoryService)
    {
        $this->categoryService = $categoryService;
    }
    
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('description')
            ->add('category', EntityType::class, array(
                    'class' => "Amulen\ClassificationBundle\Entity\Category",
                    'choices' => $this->categoryService->findByRoot("post"),
                    'choice_label' => function($category, $key, $index) {
                        $prefix = "";
                        for($i = 0; $i < $category->getLvl(); $i++){
                            $prefix .= "-";
                        }
                        return strtolower($prefix.$category->getName());
                    },
                    'multiple' => false,
                ))
            ->add('price', 'text', array("label" => "Precio"))
            ->add('enabled')
            ->add('tags', 'collection', array("type" => new Tag(), "label" => "Etiquetas"))
            ->add('mediaGallery', null, array("label" => "Galería de medios"))
            ->add('content', 'ckeditor')
            ->add('brand')
        ;
    }
<commit_msg>Fix product form<commit_after><?php

namespace Flowcode\ShopBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Amulen\ClassificationBundle\Entity\Tag;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;

class ProductType extends AbstractType
{

    private $categoryService;

    public function __construct($categoryService)
    {
        $this->categoryService = $categoryService;
    }
    
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('description')
            ->add('category', EntityType::class, array(
                    'class' => "Amulen\ClassificationBundle\Entity\Category",
                    'choices' => $this->categoryService->findByRoot("product"),
                    'choice_label' => function($category, $key, $index) {
                        $prefix = "";
                        for($i = 0; $i < $category->getLvl(); $i++){
                            $prefix .= "-";
                        }
                        return strtolower($prefix.$category->getName());
                    },
                    'multiple' => false,
                ))
            ->add('price', 'text', array("label" => "Precio"))
            ->add('enabled')
            ->add('tags', 'collection', array("type" => new Tag(), "label" => "Etiquetas"))
            ->add('mediaGallery', null, array("label" => "Galería de medios"))
            ->add('content', 'ckeditor')
            ->add('brand')
        ;
    }

{'fraction_non_alphanumeric': 0.1453387376954256, 'fraction_numerical': 0.0005790387955993051, 'mean_word_length': 1.9656652360515021, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7649939', 'n_tokens_mistral': 913, 'n_tokens_neox': 884, 'n_words': 166}