CustomerController
extends AbstractController
in package
Management of the customer directory.
Covers CRUD (creation with an optional welcome SMS), the customer detail view, search, archiving/unarchiving and DataTables lists, all scoped to the point of sale of the authenticated user.
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED_FULLY'
- #[Route]
- 'customer'
Table of Contents
Methods
- archiver() : RedirectResponse
- Method for archiving a customer
- create() : Response
- Method for creating a customer
- datatable() : JsonResponse
- Provides paginated/filtered customer data in the DataTables server-side format.
- delete() : Response
- Method for deleting a customer
- desarchiver() : RedirectResponse
- Unarchives a customer (makes it active again).
- index() : Response
- Method for displaying the list of customers
- indexArchive() : Response
- Displays the list of archived customers for the current point of sale.
- search() : Response
- Method for searching for a customer via the search bar
- showCustomer() : Response
- Method for viewing information about a customer
- update() : Response
- Method for modifying a customer
Methods
archiver()
Method for archiving a customer
public
archiver(Customer $customer, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
- $customer : Customer
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/archive/{id}'
- $name: 'customer.archive'
Return values
RedirectResponsecreate()
Method for creating a customer
public
create(EntityManagerInterface $entityManager, Request $request, TexterInterface $texter) : Response
Parameters
- $entityManager : EntityManagerInterface
- $request : Request
- $texter : TexterInterface
Tags
Attributes
- #[Route]
- '/create'
- $name: 'customer.create'
Return values
Responsedatatable()
Provides paginated/filtered customer data in the DataTables server-side format.
public
datatable(EntityManagerInterface $entityManager, Request $request, DataTableService $dataTableService) : JsonResponse
Parameters
- $entityManager : EntityManagerInterface
-
Doctrine entity manager.
- $request : Request
-
Request carrying the DataTables parameters.
- $dataTableService : DataTableService
-
Service building the DataTables response.
Attributes
- #[Route]
- '/datatable'
- $name: 'customer.datatable'
- $methods: ['GET']
Return values
JsonResponse —DataTables-compatible JSON response.
delete()
Method for deleting a customer
public
delete(Customer $customer, EntityManagerInterface $doctrine) : Response
Parameters
- $customer : Customer
- $doctrine : EntityManagerInterface
Attributes
- #[Route]
- '/delete/{id}'
- $name: 'customer.delete'
Return values
Responsedesarchiver()
Unarchives a customer (makes it active again).
public
desarchiver(Customer $customer, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
- $customer : Customer
-
Customer to restore.
- $entityManager : EntityManagerInterface
-
Doctrine entity manager.
Attributes
- #[Route]
- '/desarchive/{id}'
- $name: 'customer.desarchive'
Return values
RedirectResponse —Redirect to the customer list.
index()
Method for displaying the list of customers
public
index(EntityManagerInterface $entityManager) : Response
Parameters
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/'
- $name: 'customer.index'
Return values
ResponseindexArchive()
Displays the list of archived customers for the current point of sale.
public
indexArchive(EntityManagerInterface $entityManager) : Response
Parameters
- $entityManager : EntityManagerInterface
-
Doctrine entity manager.
Attributes
- #[Route]
- '/customer/archive/'
- $name: 'customer.archive.index'
Return values
Response —View listing the archived customers.
search()
Method for searching for a customer via the search bar
public
search(Request $request, SearchService $searchService) : Response
Parameters
- $request : Request
- $searchService : SearchService
Attributes
- #[Route]
- '/search'
- $name: 'customer.search'
- $methods: 'POST'
Return values
ResponseshowCustomer()
Method for viewing information about a customer
public
showCustomer(Customer $customer) : Response
Parameters
- $customer : Customer
Attributes
- #[Route]
- '/show/{id}'
- $name: 'customer.show'
Return values
Responseupdate()
Method for modifying a customer
public
update(Customer $customer, Request $request, EntityManagerInterface $doctrine) : Response
Parameters
- $customer : Customer
- $request : Request
- $doctrine : EntityManagerInterface
Attributes
- #[Route]
- '/update/{id}'
- $name: 'customer.update'