title: How can I get Primary Key in Yii 2 crud generator template
body: <p>I use gii code generator and I want to get primary key in </p>
  
  <pre><code>C:\wamp\www\yii2\vendor\yiisoft\yii2-gii\generators\model/default/views/index.php
  </code></pre>
  
  <p>Yii use this code</p>
  
  <pre><code>$count = 0;
  if (($tableSchema = $generator-&gt;getTableSchema()) === false) {
      foreach ($generator-&gt;getColumnNames() as $name) {
          if (++$count &lt; 6) {
              echo "            '" . $name . "',\n";
          } else {
              echo "            // '" . $name . "',\n";
          }
      }
  } else {
      foreach ($tableSchema-&gt;columns as $column) {
          $format = $generator-&gt;generateColumnFormat($column);
          if (++$count &lt; 6) {
              echo "            '" . $column-&gt;name . ($format === 'text' ? "" : ":" . $format) . "',\n";
          } else {
              echo "            // '" . $column-&gt;name . ($format === 'text' ? "" : ":" . $format) . "',\n";
          }
      }
  }
  </code></pre>
  
  <p>And I want to get primaryKey before belowing code.</p>
  
  <blockquote>
    <p>$generator->getTableSchema()->primaryKey();</p>
  </blockquote>
  
  <p>but is not working.</p>