vendor-oberon/presentation-bundle/src/Oberon/Bundle/PresentationBundle/Traits/PresentationTrait.php line 50

Open in your IDE?
  1. <?php
  2. namespace Oberon\Bundle\PresentationBundle\Traits;
  3. use Oberon\Presentation\Scope\Scope;
  4. use Symfony\Component\DependencyInjection\ContainerInterface;
  5. /**
  6. * Date: 24-7-14
  7. * @author Jurriaan Ruitenberg <jur@oberon.nl>
  8. * @copyright (c) Oberon Interactive 2014
  9. *
  10. * @property ContainerInterface $container
  11. */
  12. trait PresentationTrait
  13. {
  14. use PresentationServiceTrait;
  15. /**
  16. * @param mixed $object
  17. * @param int $scope
  18. * @param array $data
  19. * @return array
  20. * return a presentation of the
  21. */
  22. protected function getPresentation($object, $scope = Scope::ID, array $data = null) {
  23. return $this->getPresentationService()->getPresentation($object, $scope, $data);
  24. }
  25. /**
  26. * Returns the presentation build in $presentationClass of the object
  27. *
  28. * @param $object
  29. * @param $presentationClass
  30. * @param int $scope
  31. * @param array $data
  32. * @return array | object
  33. */
  34. protected function getPresentationByClass($object, $presentationClass, $scope = Scope::ID, $data = null) {
  35. return $this->getPresentationService()->getPresentationByClass($object, $presentationClass, $scope, $data);
  36. }
  37. /**
  38. * @param $collection
  39. * @param null $scope
  40. * @param array $data
  41. * @return array
  42. * Get the presentation of an object collection
  43. */
  44. protected function getPresentationList($collection, $scope = null, array $data = null) {
  45. return $this->getPresentationService()->getPresentationList($collection, $scope, $data);
  46. }
  47. /**
  48. * Returns the presentation build in $presentationClass of an object collection
  49. *
  50. * @param $collection
  51. * @param $presentationClass
  52. * @param null $scope
  53. * @param array|null $data
  54. * @return array[] | object[]
  55. */
  56. protected function getPresentationListByClass($collection, $presentationClass, $scope = null, array $data = null) {
  57. return $this->getPresentationService()->getPresentationListByClass($collection, $presentationClass, $scope, $data);
  58. }
  59. /**
  60. * Get a list of id's through the presentation class
  61. *
  62. * @param $collection
  63. * @param array $data
  64. * @param string $key
  65. * @return array
  66. */
  67. protected function getPresentationIds($collection, array $data = null, $key = 'id') {
  68. return $this->getPresentationService()->getPresentationIds($collection, $data, $key);
  69. }
  70. }