Beispiel #1
0
 /**
  * Set Resource
  *
  * @param \Parrot\API\Resource\Resource $resource
  */
 public function setResource(Resource $resource)
 {
     $this->resource = $resource;
     /**
      * Set Resource Event Manager keeping events
      * in the scope of this controller only.
      */
     $this->resource->setEventManager($this->getEventManager());
 }
Beispiel #2
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $resource = new Resource('default');
     // Set Dependencies
     $resource->setUrlHelper($serviceLocator->get('ViewHelperManager')->get('Url'));
     $resource->setServerUrlHelper($serviceLocator->get('ViewHelperManager')->get('ServerUrl'));
     // Set Input Filter
     $resourceInputFilter = new ResourceInputFilter($serviceLocator->get('HTMLPurifier'));
     $resource->setInputFilter($resourceInputFilter);
     $resource->setCacheAdapter($serviceLocator->get('Parrot\\API\\Resource\\Cache'));
     return $resource;
 }