Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. <?php  
  2.  public function countAllOrderedByCreatedAt($firstResult)
  3.     {
  4.         $conn = $this->getEntityManager()->getConnection();
  5.  
  6.         $sql = 'SELECT count(*) FROM (SELECT * FROM post LIMIT 5 OFFSET :firstResult) as pg';
  7.  
  8.         $statement = $conn->prepare($sql);
  9.  
  10.         $statement->execute(['firstResult' => 20]);
  11.  
  12.         return $statement->fetch();
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement