CategoryController
extends AbstractController
in package
Management of sale-product categories and sub-categories.
Provides full CRUD (creation via the index form, update, deletion), search, archiving/unarchiving and DataTables feeding. All operations are scoped to the point of sale of the authenticated user.
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED_FULLY'
- #[Route]
- '/category'
Table of Contents
Methods
- archive() : RedirectResponse
- `archive specified category
- datatable() : JsonResponse
- Provides paginated/filtered category data in the DataTables server-side format.
- delete() : RedirectResponse
- Remove the specified category
- index() : Response
- Display a listing of the category and create a new category.
- indexArchive() : Response
- Display a listing of the category archive
- restore() : RedirectResponse
- Desarchive specified category
- search() : Response
- Search category by all field-name
- update() : Response
- Update the specified category .
Methods
archive()
`archive specified category
public
archive(Category $category, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
- $category : Category
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/archive-category/{id}'
- $name: 'category.archive'
Return values
RedirectResponsedatatable()
Provides paginated/filtered category 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: 'category.datatable'
- $methods: ['GET']
Return values
JsonResponse —DataTables-compatible JSON response.
delete()
Remove the specified category
public
delete(EntityManagerInterface $doctrine, Category $category) : RedirectResponse
Parameters
- $doctrine : EntityManagerInterface
- $category : Category
Attributes
- #[Route]
- '/delete/{id}'
- $name: 'category.delete'
Return values
RedirectResponseindex()
Display a listing of the category and create a new category.
public
index(EntityManagerInterface $doctrine, Request $request) : Response
Parameters
- $doctrine : EntityManagerInterface
- $request : Request
Attributes
- #[Route]
- '/'
- $name: 'category.index'
Return values
ResponseindexArchive()
Display a listing of the category archive
public
indexArchive(EntityManagerInterface $entityManager) : Response
Parameters
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/index/archive'
- $name: 'category.index.archive'
Return values
Responserestore()
Desarchive specified category
public
restore(Category $category, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
- $category : Category
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/desarchive-category/{id}'
- $name: 'category.desarchive'
Return values
RedirectResponsesearch()
Search category by all field-name
public
search(Request $request, SearchService $searchService) : Response
Parameters
- $request : Request
- $searchService : SearchService
Attributes
- #[Route]
- '/search'
- $name: 'category.search'
- $methods: 'POST'
Return values
Responseupdate()
Update the specified category .
public
update(Category $category, Request $request, EntityManagerInterface $doctrine) : Response
Parameters
- $category : Category
- $request : Request
- $doctrine : EntityManagerInterface
Attributes
- #[Route]
- '/update/{id}'
- $name: 'category.update'