You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
825 B

The returned [[ActiveQuery]] instance can be further customized by calling
methods defined in [[ActiveQuery]] before `one()`, `all()` or `value()` is
called to return the populated active records:
12 years ago
~~~
// find all customers
$customers = Customer::find()->all();
12 years ago
// find all active customers and order them by their age:
$customers = Customer::find()
->where(['status' => 1])
12 years ago
->orderBy('age')
->all();
12 years ago
// find a single customer whose primary key value is 10
$customer = Customer::find(10);
12 years ago
// the above is equivalent to:
$customer = Customer::find()->where(['id' => 10])->one();
12 years ago
// find a single customer whose age is 30 and whose status is 1
$customer = Customer::find(['age' => 30, 'status' => 1]);
12 years ago
// the above is equivalent to:
$customer = Customer::find()->where(['age' => 30, 'status' => 1])->one();
~~~