title: Yii 2 Models - Class yii\db\Query contains 1 abstract method and must therefore be declared abstract or implement the remaining methods
body: <p>I am a beginner to YII2. To start of with i have used the Gii extension to generate my model and controller. i have set up my database in the db.php file found in the config folder in the root of my site.</p>
  <p>I then used the CRUD generator on that model i previously created in my admin module.</p>
  <p>when i now go to the admin module i get this error :</p>
  <pre><code>Class yii\db\Query contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (yii\db\QueryInterface::indexBy)
  </code></pre>
  <p>my model :</p>
  <pre><code>&lt;?php
  
  namespace app\models;
  
  use Yii;
  use yii\base\Model;
  use yii\data\ActiveDataProvider;
  use yii\db\ActiveRecord;
  
  /**
   * This is the model class for table &quot;user&quot;.
   *
   * @property string $id
   * @property string $name
   * @property string $username
   * @property string $pass
   * @property string $email
   * @property string $user_type
   * @property string $date_joined
   *
   * @property Authassignment $authassignment
   * @property Authitem[] $itemnames
   */
  class User extends ActiveRecord
  {
      /**
       * @inheritdoc
       */
      public static function tableName()
      {
          return 'user';
      }
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
              [['user_type'], 'string'],
              [['date_joined'], 'required'],
              [['date_joined'], 'safe'],
              [['name'], 'string', 'max' =&gt; 248],
              [['username'], 'string', 'max' =&gt; 45],
              [['pass'], 'string', 'max' =&gt; 256],
              [['email'], 'string', 'max' =&gt; 60],
              [['name', 'username', 'password', 'email', 'user_type', 'date_joined'], 'safe'],
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function attributeLabels()
      {
          return [
              'id' =&gt; 'ID',
              'name' =&gt; 'Name',
              'username' =&gt; 'Username',
              'password' =&gt; 'Password',
              'email' =&gt; 'Email',
              'user_type' =&gt; 'User Type',
              'date_joined' =&gt; 'Date Joined',
          ];
      }
  
      /**
       * @return \yii\db\ActiveQuery
       */
      public function getAuthassignment()
      {
          return $this-&gt;hasOne(Authassignment::className(), ['userid' =&gt; 'id']);
      }
  
      /**
       * @return \yii\db\ActiveQuery
       */
      public function getItemnames()
      {
          return $this-&gt;hasMany(Authitem::className(), ['name' =&gt; 'itemname'])-&gt;viaTable('_authassignment', ['userid' =&gt; 'id']);
      }
  
      public function scenarios()
      {
          // bypass scenarios() implementation in the parent class
          return Model::scenarios();
      }
  
      public function search($params)
      {
          $query = $this::find();
  
          $dataProvider = new ActiveDataProvider([
              'query' =&gt; $query,
          ]);
  
          if (!($this-&gt;load($params) &amp;&amp; $this-&gt;validate())) {
              return $dataProvider;
          }
  
          $query-&gt;andFilterWhere([
              'id' =&gt; $this-&gt;id,
              'date_joined' =&gt; $this-&gt;date_joined,
          ]);
  
          $query-&gt;andFilterWhere(['like', 'name', $this-&gt;name])
              -&gt;andFilterWhere(['like', 'username', $this-&gt;username])
              -&gt;andFilterWhere(['like', 'pass', $this-&gt;pass])
              -&gt;andFilterWhere(['like', 'email', $this-&gt;email])
              -&gt;andFilterWhere(['like', 'user_type', $this-&gt;user_type]);
  
          return $dataProvider;
      }
  }
  </code></pre>
  <p>I have tried to make the class abstract but this gave the error</p>
  <pre><code>Cannot instantiate abstract class app\models\User
  </code></pre>
  <p>What am i doing wrong.</p>
  <p>Thanks.</p>
  <h1><strong>EDIT :</strong></h1>
  <p>I have upgraded my php on the webserver to 5.5.10 and this has fixed this error, i was running V5.4</p>