findAll() in yii

In the Yii framework, the findAll() method is used to retrieve all records from a database table that match a specified condition. It is a method of the CActiveRecord class, which is the base class for all active record models in Yii. The method returns an array of active record objects, each representing a single database record.

Watch a course Learn object oriented PHP

For example, to retrieve all records from a table named "users" where the "status" column is equal to 1, you could use the following code:

$users = User::model()->findAll('status=1');

The findAll() method also accepts an array of options as a second parameter, which can be used to specify sorting, pagination, and other options for the query.

$users = User::model()->findAll(array('condition'=>'status=1','order'=>'create_time DESC'));

It can also be used with with() method to eager load related models and with joinWith() method to join related tables.