AuditReader.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * This file is part of the Sonata 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\DoctrineORMAdminBundle\Model;
  11. use Sonata\AdminBundle\Model\AuditReaderInterface;
  12. use SimpleThings\EntityAudit\AuditReader as SimpleThingsAuditReader;
  13. class AuditReader implements AuditReaderInterface
  14. {
  15. protected $auditReader;
  16. /**
  17. * @param \SimpleThings\EntityAudit\AuditReader $auditReader
  18. */
  19. public function __construct(SimpleThingsAuditReader $auditReader)
  20. {
  21. $this->auditReader = $auditReader;
  22. }
  23. /**
  24. * @param $className
  25. * @param $id
  26. * @param $revision
  27. * @return mixed
  28. */
  29. public function find($className, $id, $revision)
  30. {
  31. return $this->auditReader->find($className, $id, $revision);
  32. }
  33. /**
  34. * @param $className
  35. * @param int $limit
  36. * @param int $offset
  37. * @return mixed
  38. */
  39. public function findRevisionHistory($className, $limit = 20, $offset = 0)
  40. {
  41. return $this->auditReader->findRevisionHistory($limit, $offset);
  42. }
  43. /**
  44. * @param $classname
  45. * @param $revision
  46. * @return mixed
  47. */
  48. public function findRevision($classname, $revision)
  49. {
  50. return $this->auditReader->findRevision($revision);
  51. }
  52. /**
  53. * @param $className
  54. * @param $id
  55. * @return mixed
  56. */
  57. public function findRevisions($className, $id)
  58. {
  59. return $this->auditReader->findRevisions($className, $id);
  60. }
  61. }