<i>public static function getOne($id) { // получить записи где id=1 и получить одну запись $data =self::find() //->where(['id'=>1]) ->where(['id'=>$id]) ->one(); return $data; } 

    2 answers 2

    Sorry, this is not yii2 Active Record.

    These are the basics of PHP, and in principle any programming language. In ActiveRecord, it serves to generate a query (ActiveQuery) for a specific model from a database. So to say for auto substitution of such values ​​as from and select if you do not override them.

    PS Best of all open the class ActiveRecord and understand what's what.

      This has nothing to do with YII. This is a PHP construct. self means that the static method is being called (as in your case) or a variable that is defined and implemented in the same class or its parents.

      Those. in this example, the find method is called, which is implemented in the same class as the getOne method