class UserBrandsManager implements BasicEntityManagerInterface

Class UserBrandsManager is injected as user_brands.manager service. UserBrandsManager handles the logic for entity.

Properties

protected UserBrandsRepository $repository
protected BrandManager $brandManager
protected UserManager $userManager

Methods

__construct(UserBrandsRepository $repository, BrandManager $brandManager, UserManager $userManager)

UserBrandsManager constructor.

array
getAllBrands()

Bet all brands from database. Returns only id and name of brand

array
getDisabledBrandIdsForUser(mixed $userId, bool $joinWithBrand = false)

Gets all disabled brand for specified user If joinWithBrand param is true it will join UserDisabledBrand with Brand If joinWithBrand if false or missing function will return only ids of brands

User|null
getCurrentUser()

Get current user

array
getAllDataForDownload()

Prepare data for csv download. Create matrix of all user and all brands Where brand is disabled for user value in matrix is marked with 'X'

mixed
disableBrands(int $userId, array $disabledBrands)

Disable multiple brands for specified user

Details

at line 40
__construct(UserBrandsRepository $repository, BrandManager $brandManager, UserManager $userManager)

UserBrandsManager constructor.

Parameters

UserBrandsRepository $repository
BrandManager $brandManager
UserManager $userManager

at line 52
array getAllBrands()

Bet all brands from database. Returns only id and name of brand

Return Value

array

at line 67
array getDisabledBrandIdsForUser(mixed $userId, bool $joinWithBrand = false)

Gets all disabled brand for specified user If joinWithBrand param is true it will join UserDisabledBrand with Brand If joinWithBrand if false or missing function will return only ids of brands

Parameters

mixed $userId
bool $joinWithBrand

Return Value

array

at line 77
User|null getCurrentUser()

Get current user

Return Value

User|null

at line 88
array getAllDataForDownload()

Prepare data for csv download. Create matrix of all user and all brands Where brand is disabled for user value in matrix is marked with 'X'

Return Value

array

at line 123
mixed disableBrands(int $userId, array $disabledBrands)

Disable multiple brands for specified user

Parameters

int $userId
array $disabledBrands

Return Value

mixed