ProductStockController
extends AbstractController
in package
Management of warehouse stock (distinct from sale products).
Covers CRUD, images, movement history, archiving, search and purchase-order triggering. All operations are scoped to the point of sale of the authenticated user.
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED_FULLY'
- #[Route]
- '/product/stock'
Table of Contents
Methods
- archiver() : RedirectResponse
- Method for archived a product stock
- create() : Response
- Method creating a new product stock
- datatable() : JsonResponse
- Provides paginated/filtered warehouse-stock data in the DataTables server-side format.
- desarchiver() : RedirectResponse
- Method for desarchived a product stock
- getAllProduct() : JsonResponse
- Method for geting quantity product by id
- historiesDatatable() : JsonResponse
- Provides the movement history of a stock item in the DataTables server-side format.
- index() : Response
- indexArchive() : Response
- Method for displaying the all product stock archived
- purchaseOrderProduct() : Response
- Method for create a new purhase order for product stock
- search() : Response
- Method for searching a product stock via search bar
- show() : Response
- Method to display a retail for single product
- update() : Response
- Method for updating a single product in stock
- generatePurchaseNumber() : string
- Method for generate purchase order number
- getLastPurchaseOrderNumberForYear() : int
- Method for geting a last purchase order number for a year from the database
Methods
archiver()
Method for archived a product stock
public
archiver(ProductStock $product, EntityManagerInterface $doctrine) : RedirectResponse
Parameters
- $product : ProductStock
- $doctrine : EntityManagerInterface
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED'
- #[Route]
- '/archive/{id}'
- $name: 'product.stock.archive'
Return values
RedirectResponsecreate()
Method creating a new product stock
public
create(EntityManagerInterface $doctrine, Request $request, UploaderService $uploaderService) : Response
Parameters
- $doctrine : EntityManagerInterface
- $request : Request
- $uploaderService : UploaderService
Attributes
- #[Route]
- '/create'
- $name: 'product.stock.create'
Return values
Responsedatatable()
Provides paginated/filtered warehouse-stock 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: 'product.stock.datatable'
- $methods: ['GET']
Return values
JsonResponse —DataTables-compatible JSON response.
desarchiver()
Method for desarchived a product stock
public
desarchiver(ProductStock $product, EntityManagerInterface $doctrine) : RedirectResponse
Parameters
- $product : ProductStock
- $doctrine : EntityManagerInterface
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED'
- #[Route]
- '/desarchive/{id}'
- $name: 'product.stock.desarchive'
Return values
RedirectResponsegetAllProduct()
Method for geting quantity product by id
public
getAllProduct(ProductStock $product) : JsonResponse
Parameters
- $product : ProductStock
Attributes
- #[Route]
- '/get-product/{id}'
- $name: 'product.stock.all'
- $methods: 'GET'
Return values
JsonResponsehistoriesDatatable()
Provides the movement history of a stock item in the DataTables server-side format.
public
historiesDatatable(ProductStock $product, EntityManagerInterface $entityManager, Request $request, DataTableService $dataTableService) : JsonResponse
Parameters
- $product : ProductStock
-
Stock item whose history is listed.
- $entityManager : EntityManagerInterface
-
Doctrine entity manager.
- $request : Request
-
Request carrying the DataTables parameters.
- $dataTableService : DataTableService
-
Service building the DataTables response.
Attributes
- #[Route]
- '/{id}/histories/datatable'
- $name: 'product.stock.histories.datatable'
- $methods: ['GET']
Return values
JsonResponse —DataTables-compatible JSON response.
index()
public
index(EntityManagerInterface $entityManager) : Response
Parameters
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/'
- $name: 'product.stock.index'
Return values
ResponseindexArchive()
Method for displaying the all product stock archived
public
indexArchive(EntityManagerInterface $entityManager) : Response
Parameters
- $entityManager : EntityManagerInterface
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED'
- #[Route]
- '/index/archive'
- $name: 'product.stock.index.archive'
Return values
ResponsepurchaseOrderProduct()
Method for create a new purhase order for product stock
public
purchaseOrderProduct(ProductStock $product, EntityManagerInterface $entityManager, Request $request, UploaderService $uploaderService, MailerService $mailer) : Response
Parameters
- $product : ProductStock
- $entityManager : EntityManagerInterface
- $request : Request
- $uploaderService : UploaderService
- $mailer : MailerService
Tags
Attributes
- #[IsGranted]
- 'IS_AUTHENTICATED'
- #[Route]
- '/purchase-order/stock/{id}'
- $name: 'product.stock.purchase.order'
Return values
Responsesearch()
Method for searching a product stock via search bar
public
search(Request $request, SearchService $searchService) : Response
Parameters
- $request : Request
- $searchService : SearchService
Attributes
- #[Route]
- '/search'
- $name: 'product.stock.search'
- $methods: 'POST'
Return values
Responseshow()
Method to display a retail for single product
public
show(ProductStock $product, EntityManagerInterface $entityManager, Request $request, UploaderService $uploaderService, MailerService $mailer) : Response
Parameters
- $product : ProductStock
- $entityManager : EntityManagerInterface
- $request : Request
- $uploaderService : UploaderService
- $mailer : MailerService
Attributes
- #[Route]
- '/show/{id}'
- $name: 'product.stock.show'
Return values
Responseupdate()
Method for updating a single product in stock
public
update(ProductStock $product, EntityManagerInterface $doctrine, Request $request, UploaderService $uploaderService) : Response
Parameters
- $product : ProductStock
- $doctrine : EntityManagerInterface
- $request : Request
- $uploaderService : UploaderService
Attributes
- #[Route]
- '/update/{id}'
- $name: 'product.stock.update'
Return values
ResponsegeneratePurchaseNumber()
Method for generate purchase order number
private
generatePurchaseNumber(EntityManagerInterface $entityManager) : string
Parameters
- $entityManager : EntityManagerInterface
Tags
Return values
stringgetLastPurchaseOrderNumberForYear()
Method for geting a last purchase order number for a year from the database
private
getLastPurchaseOrderNumberForYear(int $year, EntityManagerInterface $entityManager) : int
Parameters
- $year : int
- $entityManager : EntityManagerInterface