/**
  * @param TaxonomyInterface $taxonomy
  * @param Archetype|null    $archetype
  * @return array
  */
 public function getTaxonsAsListByArchetype(TaxonomyInterface $taxonomy, Archetype $archetype = null)
 {
     $queryBuilder = $this->getQueryBuilder()->where('o.taxonomy = :taxonomy')->andWhere('o.parent IS NOT NULL')->setParameter('taxonomy', $taxonomy);
     if ($archetype) {
         $type = $archetype->getType();
         $queryBuilder->andWhere('o.' . $type . 'Archetype =:type')->setParameter('type', $archetype);
     }
     return $queryBuilder->orderBy('o.left')->getQuery()->getResult();
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->remove('attributes')->add('type', 'choice', array('label' => 'Type', 'choices' => Archetype::getTypeLabels(), 'expanded' => true))->add('widgets', 'collection', array('required' => false, 'type' => 'sylius_product_archetype_attribute_widget', 'prototype' => false, 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false));
 }