BConnect POS - Reference PHP

UserController extends AbstractController
in package

Administration of user accounts (web interface).

Covers listing, registration, update, deletion, archiving/unarchiving, search, DataTables lists and the personal profile screen (details and password change). Accounts are attached to the point of sale of the authenticated user.

Attributes
#[IsGranted]
'IS_AUTHENTICATED_FULLY'
#[Route]
'user'

Table of Contents

Methods

archiveUser()  : RedirectResponse
Method for archived a user
datatable()  : JsonResponse
Provides paginated/filtered user data in the DataTables server-side format.
delete()  : RedirectResponse
Method for deleting a user
desarchiveUser()  : RedirectResponse
Method for desarchived a user
index()  : Response
Method for displaying a list of users
indexArchive()  : Response
Method to displaying a list of archived user
register()  : Response
Method for creating a new user
search()  : Response
Method for searching a user
update()  : RedirectResponse|Response
Method for update a user
userProfile()  : Response
Displays and handles the profile screen of the authenticated user.

Methods

archiveUser()

Method for archived a user

public archiveUser(User $user, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
$user : User
$entityManager : EntityManagerInterface
Attributes
#[Route]
'/archive/{id}'
$name: 'user.archive'
Return values
RedirectResponse

datatable()

Provides paginated/filtered user 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: 'user.datatable'
$methods: ['GET']
Return values
JsonResponse

DataTables-compatible JSON response.

delete()

Method for deleting a user

public delete(User $user, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
$user : User
$entityManager : EntityManagerInterface
Attributes
#[Route]
'/delete/{id},'
$name: 'user.delete'
Return values
RedirectResponse

desarchiveUser()

Method for desarchived a user

public desarchiveUser(User $user, EntityManagerInterface $entityManager) : RedirectResponse
Parameters
$user : User
$entityManager : EntityManagerInterface
Attributes
#[Route]
'/desarchive/{id}'
$name: 'user.desarchive'
Return values
RedirectResponse

index()

Method for displaying a list of users

public index(EntityManagerInterface $entityManager) : Response
Parameters
$entityManager : EntityManagerInterface
Attributes
#[Route]
'/'
$name: 'user.index'
Return values
Response

indexArchive()

Method to displaying a list of archived user

public indexArchive(EntityManagerInterface $entityManager) : Response
Parameters
$entityManager : EntityManagerInterface
Attributes
#[Route]
'/user/index'
$name: 'user.index.archive'
Return values
Response

register()

Method for creating a new user

public register(Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, UploaderService $uploaderService, MailerService $mailer) : Response
Parameters
$request : Request
$userPasswordHasher : UserPasswordHasherInterface
$entityManager : EntityManagerInterface
$uploaderService : UploaderService
$mailer : MailerService
Attributes
#[Route]
'/register'
$name: 'user.register'
Return values
Response

Method for searching a user

public search(Request $request, SearchService $searchService) : Response
Parameters
$request : Request
$searchService : SearchService
Attributes
#[Route]
'/search'
$name: 'user.search'
Return values
Response

update()

Method for update a user

public update(User $user, EntityManagerInterface $entityManager, Request $request, UploaderService $uploaderService, UserPasswordHasherInterface $userPasswordHasher) : RedirectResponse|Response
Parameters
$user : User
$entityManager : EntityManagerInterface
$request : Request
$uploaderService : UploaderService
$userPasswordHasher : UserPasswordHasherInterface
Attributes
#[Route]
'/update/{id}'
$name: 'user.update'
Return values
RedirectResponse|Response

userProfile()

Displays and handles the profile screen of the authenticated user.

public userProfile(Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, UploaderService $uploaderService) : Response

Handles two forms: updating personal information (with a profile picture) and changing the password.

Parameters
$request : Request

HTTP request (form submission).

$userPasswordHasher : UserPasswordHasherInterface

Hashing service for the new password.

$entityManager : EntityManagerInterface

Doctrine entity manager.

$uploaderService : UploaderService

Upload service for the profile image.

Attributes
#[Route]
'/users/profile'
$name: 'app_user_profil'
Return values
Response

The profile view or a redirect after saving.

On this page

Search results