title: In ZF2, Getting last insert id after insertion without using TableGateway
body: <p>I need last insert id after executing a insert statement. Now I am not using TableGateway so <code>$this-&gt;lastInsertValue</code> is not available to me. What other options are available if I need to use Insert statement through Sql Object not a Table Gateway Object.</p>
  
  <pre><code>$objInsert = new Insert('name_master');
  $objInsert-&gt;values(array( 'username' =&gt; $name,
                  'price' =&gt; 0,
                  'is_approval_needed' =&gt; 'n'
               ));
  
  $sql = new Sql($this-&gt;adapter);
  
  $result = $sql-&gt;prepareStatementForSqlObject($objInsert)-&gt;execute()-&gt;getAffectedRows();
  </code></pre>
  
  <p>As I need to execute multiple insert statements in different tables using last insert id of previous insert, Now I want to do it in a single method of my Model.</p>