Guest User

Untitled

a guest
Apr 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Tennisconnect\DashboardBundle\Extension;
  4.  
  5. class NotificationTwigExtension extends \Twig_Extension
  6. {
  7. protected $doctrine;
  8.  
  9. public function __constructor(Registry $doctrine)
  10. {
  11. $this->doctrine = $doctrine;
  12. }
  13.  
  14. public function getFriendRequests($user)
  15. {
  16. $users = $this->doctrine
  17. ->getRepository('TennisconnectUserBundle:User')
  18. ->getFriendRequests();
  19. return count($users);
  20. }
  21.  
  22. public function getChallengeRequests()
  23. {
  24. return 2;
  25. }
  26.  
  27. public function getName()
  28. {
  29. return 'notification';
  30. }
  31.  
  32. public function getFunctions()
  33. {
  34. return array(
  35. 'getFriendRequests' => new \Twig_Function_Method($this, 'getFriendRequests'),
  36. 'getChallengeRequests' => new \Twig_Function_Method($this, 'getChallengeRequests')
  37. );
  38. }
  39. }
Add Comment
Please, Sign In to add comment