BConnect Business - Reference PHP

PointOfSaleController extends AbstractController
in package

Attributes
#[IsGranted]
'IS_AUTHENTICATED_FULLY'
#[Route]
'/point_of_sale'

Table of Contents

Properties

$apiBaseUrl  : mixed
$entityManager  : EntityManagerInterface
$tokenService  : mixed
$uploaderService  : UploaderService

Methods

__construct()  : mixed
addUserInPointOfSale()  : Response
Adds a user to a Point of Sale.
create()  : Response
Creates a new Point of Sale.
delete()  : Response
Deletes a PointOfSale entity.
edit()  : Response
Edits an existing PointOfSale entity.
editUserInPointOfSale()  : Response
Edits an existing user in a Point of Sale.
index()  : Response
Displays a list of Point of Sale entities.
indexUserOfPointOfSale()  : Response
Displays a list of users associated with a specific Point of Sale.
show()  : Response
Displays the details of a specific Point of Sale.

Properties

Methods

addUserInPointOfSale()

Adds a user to a Point of Sale.

public addUserInPointOfSale(PointOfSale $pointOfSale, Request $request, HttpClientInterface $httpClient) : Response

This method handles the form submission for adding a user to a specific Point of Sale. It sends a POST request to an external API to create the user and handles the response.

Parameters
$pointOfSale : PointOfSale

The Point of Sale entity to which the user will be added.

$request : Request

The HTTP request object.

$httpClient : HttpClientInterface

The HTTP client for making API requests.

Attributes
#[Route]
'/{id}/add/user'
$name: "app_point_of_sale_user_new"
$methods: ['GET', 'POST']
Return values
Response

The HTTP response object.

create()

Creates a new Point of Sale.

public create(Request $request, HttpClientInterface $httpClient) : Response

This method handles the creation of a new Point of Sale entity. It processes the form submission, handles file uploads for the logo, persists the entity to the database, and sends configuration data to an external API.

Parameters
$request : Request

The HTTP request object.

$httpClient : HttpClientInterface

The HTTP client for making API requests.

Tags
throws
TransportExceptionInterface

If an error occurs during the HTTP request.

Exception
Attributes
#[Route]
'/new'
$name: 'app_point_of_sale_new'
$methods: ['GET', 'POST']
Return values
Response

The HTTP response object.

delete()

Deletes a PointOfSale entity.

public delete(Request $request, PointOfSale $pointOfSale) : Response
Parameters
$request : Request

The HTTP request object.

$pointOfSale : PointOfSale

The PointOfSale entity to be deleted.

Attributes
#[Route]
'/{id}'
$name: 'app_point_of_sale_delete'
$methods: ['POST']
Return values
Response

A redirect response to the PointOfSale index route.

edit()

Edits an existing PointOfSale entity.

public edit(Request $request, PointOfSale $pointOfSale) : Response

This method handles the request to edit a PointOfSale entity. It creates and processes a form for editing the entity. If the form is submitted and valid, the changes are saved to the database and the user is redirected to the index page. If the form is not submitted or is invalid, the edit page is rendered again with the form and the current entity data.

Parameters
$request : Request

The current request instance.

$pointOfSale : PointOfSale

The PointOfSale entity to be edited.

Tags
throws
Exception
Attributes
#[Route]
'/{id}/edit'
$name: 'app_point_of_sale_edit'
$methods: ['GET', 'POST']
Return values
Response

The response instance.

editUserInPointOfSale()

Edits an existing user in a Point of Sale.

public editUserInPointOfSale(int $pointOfSaleId, int $userId, Request $request, HttpClientInterface $httpClient) : Response

This method handles the request to edit a user associated with a specific Point of Sale. It retrieves the current user data from an external API, populates a form with this data, and processes the form submission to update the user information via the API.

Parameters
$pointOfSaleId : int

The ID of the Point of Sale.

$userId : int

The ID of the user to be edited.

$request : Request

The HTTP request object.

$httpClient : HttpClientInterface

The HTTP client for making API requests.

Attributes
#[Route]
'/{pointOfSaleId}/user/{userId}/edit'
$name: 'app_point_of_sale_user_update'
$methods: ['GET', 'POST']
Return values
Response

The HTTP response object.

indexUserOfPointOfSale()

Displays a list of users associated with a specific Point of Sale.

public indexUserOfPointOfSale(PointOfSale $pointOfSale, HttpClientInterface $httpClient) : Response

This method retrieves the list of users for a given Point of Sale from an external API and renders the user index template with the retrieved data.

Parameters
$pointOfSale : PointOfSale

The Point of Sale entity.

$httpClient : HttpClientInterface

The HTTP client for making API requests.

Tags
throws
TransportExceptionInterface

If an error occurs during the HTTP request.

Attributes
#[Route]
'/{id}/user/index'
$name: 'app_point_of_sale_user_index'
Return values
Response

The HTTP response object.

show()

Displays the details of a specific Point of Sale.

public show(PointOfSale $pointOfSale, HttpClientInterface $httpClient) : Response
Parameters
$pointOfSale : PointOfSale

The Point of Sale entity.

$httpClient : HttpClientInterface

The HTTP client interface.

Tags
Route

("/{id}", name="app_point_of_sale_show", methods={"GET", "POST"})

throws
Throwable

If an error occurs during the HTTP request.

Attributes
#[Route]
'/{id}'
$name: 'app_point_of_sale_show'
$methods: ['GET', 'POST']
Return values
Response

The rendered view of the Point of Sale details.

On this page

Search results