$count = User::count(); echo "Total users: " . $count;
$count = User::find()->count(); echo "Total users: " . $count;
$em = $this->getDoctrine()->getManager(); $count = $em->getRepository(User::class)->count([]); echo "Total users: " . $count;This code snippet retrieves all User records from the database and returns the count using the Doctrine ORM.