ConfigureQueryEvent.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Event;
  11. use Sonata\AdminBundle\Admin\AdminInterface;
  12. use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
  13. use Symfony\Component\EventDispatcher\Event;
  14. /**
  15. * This event is sent by hook:
  16. * - configureQuery.
  17. *
  18. * You can register the listener to the event dispatcher by using:
  19. * - sonata.admin.event.configure.query
  20. * - sonata.admin.event.configure.[admin_code].query (not implemented yet)
  21. */
  22. class ConfigureQueryEvent extends Event
  23. {
  24. protected $admin;
  25. protected $proxyQuery;
  26. protected $context;
  27. /**
  28. * @param AdminInterface $admin
  29. * @param ProxyQueryInterface $proxyQuery
  30. * @param string $context
  31. */
  32. public function __construct(AdminInterface $admin, ProxyQueryInterface $proxyQuery, $context)
  33. {
  34. $this->admin = $admin;
  35. $this->proxyQuery = $proxyQuery;
  36. $this->context = $context;
  37. }
  38. /**
  39. * @return AdminInterface
  40. */
  41. public function getAdmin()
  42. {
  43. return $this->admin;
  44. }
  45. /**
  46. * @return string
  47. */
  48. public function getContext()
  49. {
  50. return $this->context;
  51. }
  52. /**
  53. * @return ProxyQueryInterface
  54. */
  55. public function getProxyQuery()
  56. {
  57. return $this->proxyQuery;
  58. }
  59. }