<?php
namespace Oberon\Bundle\PresentationBundle\Traits;
use Oberon\Presentation\Scope\Scope;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Date: 24-7-14
* @author Jurriaan Ruitenberg <jur@oberon.nl>
* @copyright (c) Oberon Interactive 2014
*
* @property ContainerInterface $container
*/
trait PresentationTrait
{
use PresentationServiceTrait;
/**
* @param mixed $object
* @param int $scope
* @param array $data
* @return array
* return a presentation of the
*/
protected function getPresentation($object, $scope = Scope::ID, array $data = null) {
return $this->getPresentationService()->getPresentation($object, $scope, $data);
}
/**
* Returns the presentation build in $presentationClass of the object
*
* @param $object
* @param $presentationClass
* @param int $scope
* @param array $data
* @return array | object
*/
protected function getPresentationByClass($object, $presentationClass, $scope = Scope::ID, $data = null) {
return $this->getPresentationService()->getPresentationByClass($object, $presentationClass, $scope, $data);
}
/**
* @param $collection
* @param null $scope
* @param array $data
* @return array
* Get the presentation of an object collection
*/
protected function getPresentationList($collection, $scope = null, array $data = null) {
return $this->getPresentationService()->getPresentationList($collection, $scope, $data);
}
/**
* Returns the presentation build in $presentationClass of an object collection
*
* @param $collection
* @param $presentationClass
* @param null $scope
* @param array|null $data
* @return array[] | object[]
*/
protected function getPresentationListByClass($collection, $presentationClass, $scope = null, array $data = null) {
return $this->getPresentationService()->getPresentationListByClass($collection, $presentationClass, $scope, $data);
}
/**
* Get a list of id's through the presentation class
*
* @param $collection
* @param array $data
* @param string $key
* @return array
*/
protected function getPresentationIds($collection, array $data = null, $key = 'id') {
return $this->getPresentationService()->getPresentationIds($collection, $data, $key);
}
}