1

I am using SonataAdminBundle along with SonataUserBundle to edit a list of users. I was able to extend the user entity following this post and customizing the user form in order to add new fields:

enter image description here

Now I would like to add a list of related user subscriptions after the "Another Custom Field" entry.

This should be a simple list without any edit capability. The admin should only see these entities. I tried using the sonata_type_collection type but I don't want it to appear as an editable form.

My User class is as following:

class User extends BaseUser
{
    /**
     * @var int
     *
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\Subscription", mappedBy="user")
     */
    private $subscriptions;
}
StockBreak
  • 2,857
  • 1
  • 35
  • 61

0 Answers0