title: How to specify values by using Yii2 migration?
body: <p>I'm new to <code>Yii2 framework</code>, so. I need to specify 3 <code>categories</code> by using <code>Yii2 migration</code>. </p>
  
  <p>F.e: user enters a form and in that form there is a dropdown where he can select the <code>category</code> from the specified ones, which is in the database and according to that category select <code>items</code>, which is also stored in a database.</p>
  
  <p>I've created all the tables with <code>foreign keys</code> by using migration, here is the <code>category</code> table:</p>
  
  <pre><code>&lt;?php
  
  use yii\db\Migration;
  
  class m170425_115637_sale extends Migration
  {
  public function up()
  {
      $this-&gt;createTable('sale', [
          'id' =&gt; $this-&gt;primaryKey(),
          'item_id' =&gt; $this-&gt;integer(11)-&gt;notNull(),
          'customer_name' =&gt; $this-&gt;string(255)-&gt;notNull(),
          'customer_surname' =&gt; $this-&gt;string(255)-&gt;notNull(),
          'customer_phone' =&gt; $this-&gt;string(255)-&gt;notNull(),
          'customer_email' =&gt; $this-&gt;string(255)-&gt;notNull(),
          'code' =&gt; $this-&gt;string(255)-&gt;notNull(),
          'sign' =&gt; $this-&gt;boolean(),
          'comnent' =&gt; $this-&gt;text(),
      ]);
  
      // creates index for column `item_id`
      $this-&gt;createIndex(
          'idx-post-item_id',
          'sale',
          'item_id'
      );
  
      // add foreign key for table `user`
      $this-&gt;addForeignKey(
          'fk-post-item_id',
          'sale',
          'item_id',
          'item',
          'id',
          'CASCADE'
      );
  }
  
  public function down()
  {
      $this-&gt;dropTable('sale');
  }
  </code></pre>
  
  <p>And here is <code>item</code> table:</p>
  
  <pre><code>&lt;?php
  
  use yii\db\Migration;
  
  class m170425_114148_item extends Migration
  {
  public function up()
  {
      $this-&gt;createTable('item', [
          'id' =&gt; $this-&gt;primaryKey(),
          'category_id' =&gt; $this-&gt;integer(11)-&gt;notNull(),
          'name' =&gt; $this-&gt;string(255)-&gt;notNull(),
          'price' =&gt; $this-&gt;double(),
      ]);
  
      // creates index for column `category_id`
      $this-&gt;createIndex(
          'idx-post-category_id',
          'item',
          'category_id'
      );
  
      // add foreign key for table `category`
      $this-&gt;addForeignKey(
          'fk-item-category_id',
          'item',
          'category_id',
          'category',
          'id',
          'CASCADE'
      );
  }
  
  public function down()
  {
      $this-&gt;dropTable('item');
  }
  </code></pre>
  
  <p>I hope you understand the problem, thanks for the help!</p>