Overview

Namespaces

  • ApiBundle
    • DataFixtures
      • Faker
        • Provider
    • DependencyInjection
    • Doctrine
      • DBAL
        • Type
      • ORM
        • Filter
          • User
    • Entity
    • EventListener
      • Doctrine
    • Manager
    • Utils
  • FrontBundle
    • Bundle
      • UserBundle
    • Client
      • Exception
    • Controller
    • DependencyInjection
    • Form
      • DataTransformer
      • Type
    • Menu
    • Security
      • Http
        • Authentication
    • Services
      • Http
    • Twig
    • Utils

Classes

  • BaseController
  • DashboardController
  • JobController
  • MandateController
  • UserController

Interfaces

  • ApiControllerInterface
  • Overview
  • Namespace
  • Class

Interface ApiControllerInterface

Interface registering all controller methods that should be refactoring into a base controller to provide helpers and avoid duplicating code and that are specific to this application, i.e. methods that are not in Symfony\Bundle\FrameworkBundle\Controller\Controller or which differs from it.

Direct known implementers

FrontBundle\Controller\BaseController

Indirect known implementers

FrontBundle\Controller\JobController, FrontBundle\Controller\MandateController, FrontBundle\Controller\UserController
Namespace: FrontBundle\Controller
Author: Théo FIDRY theo.fidry@gmail.com
Located at FrontBundle/Controller/ApiControllerInterface.php
Methods summary
public string
# generateUrl( string $route, array $parameters = [], boolean|string $referenceType = FrontBundle\Controller\UrlGeneratorInterface::ABSOLUTE_PATH )

Generates a URL from the given parameters.

Generates a URL from the given parameters.

If the id key of parameters passed has an URI as a value, its ID is automatically extracted from it. This is done my assuming that the ID is the last member of the URI and that and URI begins by /.

Parameters

$route
The name of the route
$parameters
An array of parameters
$referenceType
The type of reference (one of the constants in UrlGeneratorInterface)

Returns

string
The generated URL

See

UrlGeneratorInterface
public array
# decode( string $data, array $context = [] )

Decodes a JSON string into PHP data.

Decodes a JSON string into PHP data.

Parameters

$data
Data to decode
$context
options that decoders have access to.

Returns

array

Throws

Symfony\Component\Serializer\Exception\UnexpectedValueException
public Psr\Http\Message\RequestInterface
# createRequest( string $method, string|null $url = null, Symfony\Component\HttpFoundation\Request|Psr\Http\Message\RequestInterface|string|null $token = null, array $options = [] )

Send a GET request for the client and decode its response body.

Send a GET request for the client and decode its response body.

Parameters

$method
HTTP method
$url
URL, URI or route name.
$token

API token. If request, will look into the session for the API token.

$options
Options applied to the request.

Returns

Psr\Http\Message\RequestInterface

See

FrontBundle\Client\ApiClientInterface::createRequest()
public array
# requestAndDecode( string $method, string|null $url = null, Symfony\Component\HttpFoundation\Request|Psr\Http\Message\RequestInterface|string|null $token = null, array $options = [], boolean $wholeCollection = false )

Send a GET request for the client and decode its response body.

Send a GET request for the client and decode its response body.

Parameters

$method
HTTP method
$url
URL, URI or route name.
$token

API token. If request, will look into the session for the API token.

$options
Options applied to the request.
$wholeCollection

If set to true, will consider the response is a paginated collection and will go through all pages to return the complete list of entities. This parameters is ignored if the response is not a collection.

Returns

array

Throws

LogicException
When the handler does not populate a response
GuzzleHttp\Exception\RequestException
When an error is encountered

See

FrontBundle\Client\ApiClientInterface::request()
$this::decode
public array
# sendAndDecode( Psr\Http\Message\RequestInterface $request, boolean $wholeCollection = false )

Sends a single request and decode its response body.

Sends a single request and decode its response body.

Parameters

$request
Request to send
$wholeCollection

If set to true, will consider the response is a paginated collection and will go through all pages to return the complete list of entities. This parameters is ignored if the response is not a collection.

Returns

array

Throws

LogicException
When the handler does not populate a response
GuzzleHttp\Exception\RequestException
When an error is encountered
Symfony\Component\Serializer\Exception\UnexpectedValueException

See

FrontBundle\Client\ApiClientInterface::send()
$this::decode
public
# handleGuzzleException( GuzzleHttp\Exception\TransferException $exception )

Handle Guzzle exceptions. Assumes the exception was thrown while sending a request to the API. For more information regarding Guzzle exceptions, refer to * http://guzzle.readthedocs.org/en/latest/quickstart.html#exceptions.

Handle Guzzle exceptions. Assumes the exception was thrown while sending a request to the API. For more information regarding Guzzle exceptions, refer to * http://guzzle.readthedocs.org/en/latest/quickstart.html#exceptions.

Parameters

$exception
API documentation generated by ApiGen