AuditReader.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. * {@inheritdoc}
  25. */
  26. public function find($className, $id, $revision)
  27. {
  28. return $this->auditReader->find($className, $id, $revision);
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function findRevisionHistory($className, $limit = 20, $offset = 0)
  34. {
  35. return $this->auditReader->findRevisionHistory($limit, $offset);
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function findRevision($classname, $revision)
  41. {
  42. return $this->auditReader->findRevision($revision);
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function findRevisions($className, $id)
  48. {
  49. return $this->auditReader->findRevisions($className, $id);
  50. }
  51. }