Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. Hello, i am using cakephp 3.0.3 i have following custome finder in ThreadTable,
  2.  
  3. //ThreadTable
  4. public function findWithUserCount(Query $query, array $options)
  5. {
  6. return $query
  7. ->matching('Users')
  8. ->select([
  9. 'Threads.id',
  10. 'count' => 'COUNT(Users.id)'
  11. ])
  12. ->group('Threads.id HAVING count = ' . $options['count']);
  13. }
  14.  
  15. and i am access this finder from my controller as bellow,
  16. $query = $this->Threads
  17. ->find('withUserCount', ['count' => 2]);
  18.  
  19. so mysql will give me proper answer but postgressql does not parse the syntex, it give me error like "ERROR: column "count" does not exist"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement