Overview

Namespaces

  • PipelinerSales
    • ApiClient
      • Http
      • Query
      • Repository
        • Rest

Classes

  • RestCreatedResponse
  • RestInfoMethods
  • RestRepository
  • RestRepositoryFactory
  • Overview
  • Namespace
  • Class
  • Tree

Class RestRepository

Class for retrieving and manipulating entities using Pipeliner's REST API.

PipelinerSales\ApiClient\Repository\Rest\RestRepository implements PipelinerSales\ApiClient\Repository\RepositoryInterface
Namespace: PipelinerSales\ApiClient\Repository\Rest
Located at PipelinerSales/ApiClient/Repository/Rest/RestRepository.php
Methods summary
public
# __construct( $urlPrefix, $entity, $entityPlural, PipelinerSales\ApiClient\Http\HttpInterface $connection, $dateTimeFormat )
public PipelinerSales\ApiClient\Entity
# getById( string $id )

Returns an entity with the specified ID

Returns an entity with the specified ID

Parameters

$id

Returns

PipelinerSales\ApiClient\Entity

Throws

PipelinerSales\ApiClient\Http\PipelinerHttpException

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::getById()
public PipelinerSales\ApiClient\EntityCollection
# get( mixed $criteria = null )

Returns a collection of all entities satisfying the provided criteria

Returns a collection of all entities satisfying the provided criteria

Parameters

$criteria

Can be one of the following

  • null - fetches all entities up to a default limit of 25
  • a PipelinerSales\ApiClient\Query\Criteria object
  • a PipelinerSales\ApiClient\Query\Filter object
  • a PipelinerSales\ApiClient\Query\Sort object
  • a query string following the format described at http://workspace.pipelinersales.com/community/api/data/Querying_rest.html
  • an array with keys corresponding to the format at http://workspace.pipelinersales.com/community/api/data/Querying_rest.html

Returns

PipelinerSales\ApiClient\EntityCollection

Throws

PipelinerSales\ApiClient\Http\PipelinerHttpException
when retrieving data from the server fails
PipelinerSales\ApiClient\PipelinerClientException
when provided criteria is invalid

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::get()
public PipelinerSales\ApiClient\Entity
# create( )

Creates a new entity. Please note that this entity won't exist on the server until you save it by calling the save method.

Creates a new entity. Please note that this entity won't exist on the server until you save it by calling the save method.

Returns

PipelinerSales\ApiClient\Entity

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::create()
public PipelinerSales\ApiClient\Http\Response
# delete( mixed $entity, integer $flags = PipelinerSales\ApiClient\Repository\RepositoryInterface::FLAG_ROLLBACK_ON_ERROR )

Deletes an entity

Deletes an entity

Parameters

$entity
the entity to delete, or an array of multiple entities
$flags

used only if multiple entities are provided, flags described on http://workspace.pipelinersales.com/community/api/data/Methods_rest.html

Returns

PipelinerSales\ApiClient\Http\Response
response to the delete HTTP request

Throws

PipelinerSales\ApiClient\Http\PipelinerHttpException
PipelinerSales\ApiClient\PipelinerClientException

when the entity provided doesn't have an ID, which usually means that it's a newly created entity that wasn't saved yet

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::delete()
public PipelinerSales\ApiClient\Http\Response
# deleteById( mixed $id, integer $flags = PipelinerSales\ApiClient\Repository\RepositoryInterface::FLAG_ROLLBACK_ON_ERROR )

Deletes one or more entities specified by their ID

Deletes one or more entities specified by their ID

Parameters

$id
the ID of the entity to delete, or an array containing multiple IDs
$flags

used only if multiple IDs are provided, flags described on http://workspace.pipelinersales.com/community/api/data/Querying_rest.html

Returns

PipelinerSales\ApiClient\Http\Response
response to the delete HTTP request

Throws

PipelinerSales\ApiClient\Http\PipelinerHttpException

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::deleteById()
public PipelinerSales\ApiClient\Http\Response
# bulkUpdate( mixed $data, integer $flags = PipelinerSales\ApiClient\Repository\RepositoryInterface::FLAG_ROLLBACK_ON_ERROR, integer $sendFields = PipelinerSales\ApiClient\Repository\RepositoryInterface::SEND_MODIFIED_FIELDS )

Updates multiple entities at once

Updates multiple entities at once

Parameters

$data

entities to update, where each entity is either an entity object or an associative array with keys corresponding to fields and values to the entity's values. See the setEntities method at http://workspace.pipelinersales.com/community/api/data/Methods_rest.html

$flags

flags described on http://workspace.pipelinersales.com/community/api/data/Methods_rest.html

$sendFields

whether to upload all the fields for Entity objects, or just the fields which have been modified in code since the entity was loaded/saved

Returns

PipelinerSales\ApiClient\Http\Response
response to the HTTP request

Throws

PipelinerSales\ApiClient\Http\PipelinerHttpException

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::bulkUpdate()
public PipelinerSales\ApiClient\Http\Response|CreatedResponse
# save( mixed $entity, integer $sendFields = PipelinerSales\ApiClient\Repository\RepositoryInterface::SEND_MODIFIED_FIELDS )

Uploads an entity to the server.

Uploads an entity to the server.

Parameters

$entity
the entity to upload, an PipelinerSales\ApiClient\Entity object or an associative array
$sendFields

whether to upload all the fields for Entity objects, or just the fields which have been modified in code since the entity was loaded/saved

Returns

PipelinerSales\ApiClient\Http\Response|CreatedResponse
response to the HTTP request

Throws

PipelinerSales\ApiClient\Http\PipelinerHttpException

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::save()
public PipelinerSales\ApiClient\EntityCollectionIterator
# getEntireRangeIterator( PipelinerSales\ApiClient\EntityCollection $collection )

Returns an iterator set to the offset of the query's criteria

Returns an iterator set to the offset of the query's criteria

Parameters

$collection

Returns

PipelinerSales\ApiClient\EntityCollectionIterator

Implementation of

PipelinerSales\ApiClient\Repository\RepositoryInterface::getEntireRangeIterator()
Constants inherited from PipelinerSales\ApiClient\Repository\RepositoryInterface
FLAG_GET_NO_DELETED_ID, FLAG_IGNORE_AND_RETURN_ERRORS, FLAG_IGNORE_ON_ERROR, FLAG_INSERT_ON_UPDATE, FLAG_ROLLBACK_ON_ERROR, FLAG_VALIDATE_ONLY_UPDATED_FIELDS, SEND_ALL_FIELDS, SEND_MODIFIED_FIELDS
API documentation generated by ApiGen