ODataProducer

Component ID

1920596

Component name

ODataProducer

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

1722

Component created

Component changed

Component body

This is a library module. It provides no out of the box functionality other then providing a single point of contact to the ODataProducer library.

Requirements

The ODataProducer module requires the following libraries and modules:

The module requires PHP 5.3 or higher to be installed because the third party ODataProducer library uses namespaces.

Installation

In order for the ODataProducer module to work you need to perform the following steps before installing:

  1. Download and install the Libraries 2.x module.
  2. Download the ODataProducer library.
  3. Copy the folder library/ODataProducer from the download in step 2 to sites/all/libraries. The ODataProducer library in Drupal should now be located at sites/all/libraries/ODataProducer.
  4. Enable the ODataProducer module.

Documentation

Visit OData and ODataProducer library for more information about OData and how the library should be used.

Example usage

In this example we will create an entity ODataProducer module named entity_odata. Please note that this is simply a dummy module to illustrate how to access the ODataProducer library.

The entity_odata.info file will contain the following:

name = Entity OData
description = Provides ODataProducer integration for entities.
package = OData
core = 7.x
; Module dependencies:
dependencies[] = odataproducer
; Classes defined by the Entity OData module:
files[] = lib/EntityODataService.inc

Next we will create an empty entity_odata.module module file:

<?php
/**
 * @file
 * Defines the hooks and custom API functions for the Entity OData module.
 */
 // Custom implementation...

Now for the ODataProducer library integration part. Create the file lib/EntityODataService.inc which will contain our DataService implementation. To access the ODataProducer library simply use the PHP use statement to include the classes you require.

<?php
  // Include the required ODataProducer classes.
  use ODataProducerDataService;
  use ODataProducerIServiceProvider;
  
  // Define our EntityODataService class.
  class EntityODataService extends DataService implements IServiceProvider {
    
	// Custom implementation...
	
  }
?>