You are here

public function ServicesClientConnection::__construct in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_client_connection/include/connection.inc \ServicesClientConnection::__construct()

Initialize connection to remote Drupal site

Parameters

$connection: Connection object from DB or File

File

services_client_connection/include/connection.inc, line 58
Main services client connection class which exposes simple API

Class

ServicesClientConnection
@file Main services client connection class which exposes simple API

Code

public function __construct($connection) {
  $this->connection = $connection;

  // Create authentication plugin
  $this->auth = $this
    ->getPlugin('auth');

  // Create server plugin
  $this->server = $this
    ->getPlugin('server');

  // Create
  $this->request = $this
    ->getPlugin('request');

  // Connect
  $this->auth
    ->connect();

  // Authenticate
  $this->auth
    ->login();
}