Activityquery
path:vender/yiisoft/yii2/db/activequery.php Description
Activequery represents a DB query associated with an active Record class, which may be a normal query, or it may be used for associative content; Normal activequery instances of representations
Typically created through Activerecord::find () and Activerecord::findbysql (), you can retrieve the results of a query by one () returns the first line of content that is queried from the database, and all () returns the results of all queries; COUNT () returns the number of records queried, sum () returns the sum value of a pure numeric column, average () returns the average of a pure numeric column, Min () returns the minimum value of a pure numeric column, and Max () returns the maximum value of a pure numeric column; scalar () returns the value of the first column in the first row of the query Lumn () returns the first column of the query, and exists () queries whether the content exists in the query results;
Examples of Use methods: Activerecord::find ()->one ()
Because Activequery inherits from query, we can also use the query class method: with () to develop the relational table used by this query; Joinwith () reuses a relational query definition and adds it to another query; Indexby () Returns the column that was made in the query result; Asarray () returns the query result as an array;
Use method: Activerecord::find ()->asarray ()->one () returns the first element of the result array as an array returns the associated content query
Created by Activerecord::hasone () or Activerecord::hasmany (), the association activequery represents the relationship between two active Record classes;