BConnect POS - Reference PHP

SessionSaleController extends AbstractController
in package

API Platform action controller for mobile cash sessions.

Its methods are wired as operations of the SessionSale entity: reading the active session, opening and closing.

Table of Contents

Properties

$entityManager  : EntityManagerInterface
$sessionSaleRepository  : SessionSaleRepository

Methods

__construct()  : mixed
closeSession()  : Response
Closes a cash session and places it pending manager validation.
getActiveSession()  : Response
Returns the active cash session of the current user.
startSession()  : Response
Opens a new cash session for the current user.

Properties

Methods

closeSession()

Closes a cash session and places it pending manager validation.

public closeSession(SessionSale $data) : Response

Checks that the session belongs to the user; an already-closed session is returned as is (idempotence).

Parameters
$data : SessionSale

Session to close (resolved by API Platform).

Return values
Response

Updated session (group "session:read"); 401 if unauthenticated, 403 if the session does not belong to the user.

getActiveSession()

Returns the active cash session of the current user.

public getActiveSession() : Response

When no session is open, returns an explicit 200 ("active" set to false) rather than a 404.

Return values
Response

Serialized session (group "session:read") or 401 if unauthenticated.

startSession()

Opens a new cash session for the current user.

public startSession() : Response

Refuses opening if a session is already active (409).

Return values
Response

Created session (201, group "session:read"); 401 if unauthenticated, 409 if a session is already open.

On this page

Search results