title: Many to many with attributes (sonata_type_collection) in sonata admin bundle
body: <p>I have two entities Ventes and Article with many to many relationship and in the entity relation is ventes_article that have the attribut "quantite" :</p>
  
  <pre><code>    &lt;?php
  
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Ventes
   *
   * @ORM\Table(name="ventes")
   * @ORM\Entity(repositoryClass="AppBundle\Repository\VentesRepository")
   */
  class Ventes
  {
      /**
       * @var int
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      #......................
  
  
  
      /**
       * Many Articles have Many paks.
       * @ORM\ManyToMany(targetEntity="Article", inversedBy="Ventes")
       * @ORM\JoinTable(name="ventes_article")
       */
      private $articles;
  
  
  
  
  
      /**
       * Add article
       *
       * @param \AppBundle\Entity\Article $article
       *
       * @return Ventes
       */
      public function addArticle(\AppBundle\Entity\Article $article)
      {
          $this-&gt;articles[] = $article;
  
          return $this;
      }
  
      /**
       * Remove article
       *
       * @param \AppBundle\Entity\Article $article
       */
      public function removeArticle(\AppBundle\Entity\Article $article)
      {
          $this-&gt;articles-&gt;removeElement($article);
      }
  
      /**
       * Get articles
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getArticles()
      {
          return $this-&gt;articles;
      }
  
      #.............................
      #..........
  }
  </code></pre>
  
  <p>and this is my entity Article :</p>
  
  <pre><code>    &lt;?php
  
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Article
   *
   * @ORM\Table(name="article")
   * @ORM\Entity(repositoryClass="AppBundle\Repository\ArticleRepository")
   */
  class Article
  {
      /**
       * @var int
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
  
      /**
       * Many packs have Many article.
       * @ORM\ManyToMany(targetEntity="Ventes", mappedBy="Article")
       * @ORM\JoinTable(name="ventes_article")
       */
      private $ventes;
  
      public function __construct() {
          $this-&gt;ventes = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;packs = new \Doctrine\Common\Collections\ArrayCollection();
      }
  
  
  #/............
  
  
  
  /**
   * Add vente
   *
   * @param \AppBundle\Entity\Ventes $vente
   *
   * @return Article
   */
  public function addVente(\AppBundle\Entity\Ventes $vente)
  {
      $this-&gt;ventes[] = $vente;
  
      return $this;
  }
  
  /**
   * Remove vente
   *
   * @param \AppBundle\Entity\Ventes $vente
   */
  public function removeVente(\AppBundle\Entity\Ventes $vente)
  {
      $this-&gt;ventes-&gt;removeElement($vente);
  }
  
  /**
   * Get ventes
   *
   * @return \Doctrine\Common\Collections\Collection
   */
  public function getVentes()
  {
      return $this-&gt;ventes;
      }
  
  }
  </code></pre>
  
  <p>and in my class <code>VentesAdmin</code> I have :</p>
  
  <pre><code>    &lt;?php
  
  namespace AppBundle\Admin;
  
  use Sonata\AdminBundle\Admin\AbstractAdmin;
  use Sonata\AdminBundle\Datagrid\ListMapper;
  use Sonata\AdminBundle\Show\ShowMapper;
  use Sonata\AdminBundle\Datagrid\DatagridMapper;
  use Sonata\AdminBundle\Form\FormMapper;
  use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  use Sonata\AdminBundle\Route\RouteCollection;
  
  class VentesAdmin extends AbstractAdmin
  {
  
  
  
      protected function configureFormFields(FormMapper $formMapper)
      {
          $formMapper
  
  
          -&gt;with('Acticles', array('class' =&gt; 'col-md-12'))
          -&gt;add('articles', 'sonata_type_model', array(
              'class' =&gt; 'AppBundle\Entity\Article',
              'property' =&gt; 'reference',
              'multiple' =&gt; true,
              'required' =&gt; false,
          ))
  
  
          -&gt;end()
          ;
      }
  
      protected function configureDatagridFilters(DatagridMapper $datagridMapper)
      {
  
      }
  
      protected function configureListFields(ListMapper $listMapper)
      {
  
      }
  
  
  
      protected function configureShowFields(ShowMapper $showMapper)
      {
  
      }
  
  }
  </code></pre>
  
  <p>in result :</p>
  
  <p><a href="https://i.stack.imgur.com/AApW8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AApW8.png" alt="enter image description here"></a></p>
  
  <p>but I want to show this result with costum attributes for same Article :</p>
  
  <p><a href="https://i.stack.imgur.com/S3HS5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S3HS5.jpg" alt="enter image description here"></a></p>
  
  <p>can you help me ??</p>