symfony - Product, Attributes and Values Symfony3 -


i question. schema:

my schema

i want create form symfony 3 have more field of entitytype 1 each attribute, say:

  • attribute: color -> values: red, green, blue...
  • attribute: dimensions -> values: 100x20, 120x40, 140x80, ....

then 2 fields in product, 1 color , other dimensions values

can create collectiontype fields inside?

i did this:

    $atributos = $em->getrepository("appbundle:atributo")             ->findall();      $formulario_articulo = $this->createform(articulotype::class, $articulo);      $repositorio = $em->getrepository("appbundle:valoratributo");      $i = 0;     foreach ($atributos $atributo) {         $id_atributo = $atributo->getid();         $query = $repositorio                 ->createquerybuilder('va')                 ->where('va.atributo = :id')                 ->orderby('va.valor', 'asc')                 ->setparameter('id', $id_atributo);         $formulario_articulo->add(str_replace(' ', '', $atributo->getnombre()), entitytype::class, array(             'class' => 'appbundle:valoratributo',             'choice_value' => 'id',             'choice_label' => 'valor',             'choice_attr' => array('style' => 'padding:1px'),             'query_builder' => $query,             'mapped' => false,             'multiple' => false,             'required' => false,             'placeholder' => 'selecciona',             'label' => $atributo->getnombre(),         ));         $i++;     } 

but, want collectiontype better...


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -