title: Symfony multiple user types and custom user provider
body: <p>I am designing architecture and database for an application similar to Uber.  And I am stuck with designing <code>User</code> entity and creating custom User provider. There are 2 types of <code>User</code> <code>driver</code> and <code>customer</code>. User can register his emails as both <code>driver</code> and <code>customer</code>.</p>
  
  <p>Is there good reading or projects where I can learn about best approach to creating app with multiple user types.</p>
  
  <p>This is what I currently came up with:</p>
  
  <p>I started with abstract <code>User</code> entity</p>
  
  <pre><code>/**
   * @ORM\InheritanceType("JOINED")
   * @ORM\DiscriminatorColumn(name="discr", type="string")
   * @ORM\DiscriminatorMap({"customer" = "Customer", "driver" = "Driver"})
   * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
   */
  abstract class User {
       /**
        * @ORM\Id()
        * @ORM\GeneratedValue()
        * @ORM\Column(type="integer")
        */
        protected $id;
  }
  </code></pre>
  
  <p>and <code>Customer</code> class looks like:</p>
  
  <pre><code>class Customer extends User
  {
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    protected $id;
  
    /**
     * @var string
     *
     * @ORM\Column(type="string", nullable=false, name="email", unique=true)
     */
    protected $email;
  </code></pre>
  
  <p><code>Driver</code> class:</p>
  
  <pre><code> class Driver extends User
     {
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    protected $id;
  
    /**
     * @var string
     *
     * @ORM\Column(type="string", nullable=false, name="email", unique=true)
     */
    protected $email;
  </code></pre>
  
  <p>However I am not sure if this User entities structure is a good idea. But if I continue with this db model what would be best strategy for user authorisation? 
  I am planning to use FOS oAuth for security. Is it better to have separate firewalls for each type of <code>User</code>? </p>