P
P
Petr Fronin2016-07-30 19:11:30
Yii
Petr Fronin, 2016-07-30 19:11:30

How to get the number of received records in Yii2?

Is it possible in Yii2 to find out the number of records returned by the database? I do it like this:

$video = Video::findAll([]);
$countVideo = Video::find([])->count();

but it is 2 requests to base!!! I would like to do something like:
$video = Video::findAll([]);
$countVideo = $video->count();

Is there any variant of such implementation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Bukharev, 2016-07-30
@amar_std

$video = Video::findAll([]);
$count=count($video);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question