title: Zend Framework 2: How to create own User mapper for ZfcUser
body: <p>I am working on my first Zend Framework 2 Project. I have implemented ZfcUser in my Project and since I have slightly different Columns in my Database Table, I want to overwrite the User Mapper from ZfcUser. I have searched through the Internet and on here, but did not get the solutions to work. I have to admit that the solution I found is from 2012 (<a href="https://stackoverflow.com/questions/13186809/zf2-custom-user-mapper-for-zfcuser-module">ZF2: Custom user mapper for ZfcUser module</a>), so maybe something has changed in the meantime.</p>
  
  <p>So what have I done so far. I have created my own User entity. If I understood it right then it needs to extend ZfcUser which I have done like this:</p>
  
  <p><strong>module/Application/src/Entity/User.php</strong>
      
  
  <pre><code>namespace Application\Entity;
  use Doctrine\ORM\Mapping as ORM;
  use ZfcUser\Entity\User as ZfcUser;
  
  /**
   * User
   *
   * @ORM\Table(name="user")
   * @ORM\Entity
   */
   class User extends ZfcUser
   {
  
  /**
   * @var integer
   *
   * @ORM\Column(name="id", type="integer", nullable=false)
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="IDENTITY")
   */
   protected $id;
  
  /**
   * @var string
   *
   * @ORM\Column(name="username", type="string", length=255, nullable=false)
   */
   protected $username;
  </code></pre>
  
  <p>I then copied the zfcuser.global.php and moved it in the Folder config/autoload/zfcuser.global.php</p>
  
  <p>In this file I have activated  'user_entity_class' => 'Application\Entity\User',
  I hope this is correct so far. </p>
  
  <p>Now I need my own UserMapper. As far what I understood this can not be done through the config file. I copied the Folder "Mapper" with all its files from zfc-user/src/ZfcUser/Mapper into my Application Module. I changed the Namespace from all the files. Now I am confused what else I need to copy, the Service and/or the Factory Folder? And where and how do I tell my Application to use my own Mapper instead of ZfcUser? I just don't get it and hope someone can give me some assistance. Thank you very much in advance !</p>