How can I use my session database with Zend's Session Manager?
<p>When the <a href="https://framework.zend.com/manual/2.4/en/modules/zend.session.manager.html" rel="nofollow noreferrer">Zend Session Manager from the tutorial</a> starts a session, it generates a session key and posts a whole lot of data into the session. But I have a session system already set up with my own session keys and a different set of session data. How can I change the Zend configuration to use mine instead?</p>

<p>For reference, here is the Zend Session:</p>

<pre><code>array (size=2)
  '__ZF' =&gt; 
    array (size=2)
      '_REQUEST_ACCESS_TIME' =&gt; float 1468447555.1396
      '_VALID' =&gt; 
        array (size=3)
          'Zend\Session\Validator\Id' =&gt; string 'xxxxxxxxxxxxxxxxxxxxxxxxxx' (length=26)
          'Zend\Session\Validator\RemoteAddr' =&gt; string '--ip addr--' (length=13)
          'Zend\Session\Validator\HttpUserAgent' =&gt; string '--user agent info--' (length=114)
  'initialized' =&gt; 
    object(Zend\Stdlib\ArrayObject)[371]
      protected 'storage' =&gt; 
        array (size=3)
          'init' =&gt; int 1
          'remoteAddr' =&gt; string '--ip addr--' (length=13)
          'httpUserAgent' =&gt; string '--user agent info--' (length=114)
      protected 'flag' =&gt; int 2
      protected 'iteratorClass' =&gt; string 'ArrayIterator' (length=13)
      protected 'protectedProperties' =&gt; 
        array (size=4)
          0 =&gt; string 'storage' (length=7)
          1 =&gt; string 'flag' (length=4)
          2 =&gt; string 'iteratorClass' (length=13)
          3 =&gt; string 'protectedProperties' (length=19)
</code></pre>

<p>And here's what the session information I'm currently storing looks like (it's in a database, so I currently reference it with a Doctrine Entity):</p>

<pre><code>object(MyModule\Entity\MySession)[550]
  protected 'sessionid' =&gt; string 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' (length=40)
  protected 'data1' =&gt; string 'xxxxx' (length=5)
  protected 'data2' =&gt; string 'xxxxxxxxxxxx' (length=12)
  protected 'datatime' =&gt; 
    object(DateTime)[547]
      public 'date' =&gt; string '2016-07-13 17:05:52.000000' (length=26)
      public 'timezone_type' =&gt; int 3
      public 'timezone' =&gt; string 'xxxxxxxxxxxxxxx' (length=15)
  protected 'data3' =&gt; boolean false
  protected 'data4' =&gt; string '' (length=0)
  protected 'data5' =&gt; int 9
  protected 'data6' =&gt; int 17765
  protected 'data7' =&gt; boolean false
</code></pre>

<p>My code for the session manager comes from <a href="https://stackoverflow.com/questions/38339656/how-to-use-zend-2-save-handler-dbtablegateway/38357149#38357149">this SO answer</a>, so I'm providing a link rather than repasting it and cluttering up this question. </p>

<p>The reason I want to use Zend Session Manager rather than simply referencing my stored session information with Doctrine is so that I have a layer between the my program and the stored session information - so then I can change the way I access the session information without having to change my entire program.</p>