CategoryManager
class CategoryManager implements BasicEntityManagerInterface, CategoryManagerInterface, CSVManagerInterface, JQGridInterface
Class CategoryManager is injected as alligator.category_manager service. CategoryManager handles the logic for managed entity.
Traits
Properties
| protected CategoryRepository | $repository | ||
| protected CategoryEventContainer | $eventContainer | ||
| protected array | $leafsArray |
Methods
No description
No description
No description
Get entities from database by ids
Translate category for key and locale
Get all categories
Returns all objects without additional JOIN query
Find all parent categories
Find all categories with containing brands
Find all categories ids
Get all categories id and name
Get all categories id, name and description
Find all categories for product add
Get database category by name
Get database category by code
Get parent category by slug
Delete categories from array
Get database categories from array
Get featured categories
Get first level categories for category aggregator page
Get all categories
Export to CSV
Custom export to CSV
Get new Category object
Import from CSV with base64 content of a file
Persist entities to database
Convert from CSV rows to tree
Generate ids for category tree
Convert from CSV rows to tree
Generate ids for category tree
Get root categories
Get root category from database
Get root object from database
Check if logged user has role admin
Get current locale from request
Get products for category with pagination
Sort products inside category
Get category filter prices by category
Save tree category for add can be used from cmd
Get category tree for backend
Edit category tree
Delete category from tree structure
Get all categories for tree
Get all tree categories for add category page
No description
No description
Set category tree to cache
Get category tree from cache
Get megamenu tree form cache
Get all categories for frontend
Set megamenu categories tree to cache
This method sends signal for cashing html tree of categories
This method sends category has changed (edit or delete)
Returns translator service
Generate route by name with provided data
Get category objects by id
Get category filter for category with slug
Get suggested prices for category filter by products in that category
Get suggested brands for category filter
Dispatch promo products cache remove - category of product ca be hidden
Dispatch promo products cache remove - category of product ca be hidden
Update display for subcategories of root given category
Dispatch category tree decorator event with locale argument
Dispatch category tree conditions event
Get products by category slug
Get search settings from database
Update categories from cmd
Update parent category visibility depending on child categories
Get category fields from entity metadata
Get category fields for CSV import Logic when we import categories with name, title, description, parent, etc.
Get category parent import options for CSV import
Get settings fileds from database
Get custom category fields for category export
Get category slug from request
Get category from request slug
Get available languages
Dispatch generate translations signal
Get parent image path for category with provided id
Get external image by category id
Get external parent image by category id
Set all categories (id and name) to cache
Set footer layout to cache
Add new request to request stack
Search categories using Filter and pagination data
Get category id and category code
Save multiple categories
Get category object reference by id
Dispatch menu update remove signal with id, slug and name
Dispatch product permissions update signal
Param $categories is a string, example "1,2,4,15"
Clear tree query result cache
Get current logged user
Create regex event
No description
Update hide from menu property to provided state on categories that match provided slug
Delete Images from category gallery
Details
in JQGridManagerTrait at line 26
mixed
searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)
in JQGridManagerTrait at line 40
mixed
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)
in JQGridManagerTrait at line 53
mixed
getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)
in BlockElementManagerTrait at line 28
array
getEntitiesForBlockElementsExtension(array $ids)
Get entities from database by ids
in BlockElementManagerTrait at line 40
array
getEntityNamesForIds(array $ids)
Get id and name of entity
at line 86
__construct(CategoryRepository $repository, CategoryEventContainer $eventContainer)
at line 99
string
transCategory(string $key, string $locale)
Translate category for key and locale
at line 108
array
getAllCategoriesNew()
Get all categories
at line 117
QueryBuilder
findAllCategories()
Returns all objects without additional JOIN query
at line 130
mixed
findAllParentCategories(int $id, int $lft, int $rgt)
Find all parent categories
at line 143
array
findAllCategoriesWithContainingBrands()
Find all categories with containing brands
at line 159
mixed
findAllCategoriesIds()
Find all categories ids
at line 168
array
getAllCategoriesIdAndName()
Get all categories id and name
at line 177
array
getAllCategoriesIdNameAndDescription()
Get all categories id, name and description
at line 187
array
findAllCategoriesForProductAdd()
Find all categories for product add
at line 210
mixed
getDBCategoryByName(String $categoryName)
Get database category by name
at line 223
mixed
getDBCategoryByCode(String $categoryCode)
Get database category by code
at line 236
mixed
getParentCategorySlug(String $slug)
Get parent category by slug
at line 250
mixed
getDBCategoryIDBySlug(Category $category)
Get category id by slug
at line 264
mixed
getDBCategoryFilterDataSlug(Category $category)
Get database category filter by slug
at line 277
Category
getDBCategoryForCategoryPage(Category $category)
Get category for category page
at line 290
Category
deleteCategory(mixed $array)
Delete categories from array
at line 320
ArrayCollection
getCategoriesGroup(mixed $array)
Get database categories from array
at line 331
array
getFeaturedCats(int $max = 6)
Get featured categories
at line 340
array
getAggregatorCategories()
Get first level categories for category aggregator page
at line 352
array
getAllCats(null $rootCats = null)
Get all categories
at line 361
mixed|void
exportToCSV()
Export to CSV
at line 372
mixed|void
exportCustom(array $data)
Custom export to CSV
at line 381
CSVEntityInterface
getEntityObject()
Get new Category object
at line 398
mixed
importFromCSV(mixed $base64Content, mixed $locale, array $propertyMappings = array(), mixed $importHasParentFiled = false)
Import from CSV with base64 content of a file
at line 423
mixed
saveObjectsFromCSV(ArrayCollection $objectList, array $csvRow, array $entityCSVHeaders, array $propertyMappings = array())
Persist entities to database
at line 447
array
convertFromCSVRowsToTreeWithParentName(array $objectList)
Convert from CSV rows to tree
at line 480
generateIdsForCategoryTreeWithParentName(mixed $parent, array $treeCats)
Generate ids for category tree
at line 525
array
convertFromCSVRowsToTree(array $objectList)
Convert from CSV rows to tree
at line 563
generateIdsForCategoryTree(mixed $parent, array $treeCats)
Generate ids for category tree
at line 605
QueryBuilder
getRootCategories(null $limit = null)
Get root categories
at line 618
QueryBuilder
getRootFromDb()
Get root category from database
at line 630
QueryBuilder
getRootObjFromDb()
Get root object from database
at line 640
mixed
hasRoleAdmin()
Check if logged user has role admin
at line 650
string
getCurrentLocale()
Get current locale from request
at line 666
array
getProductsByCategoryWithPaginationSimple($id, $page, $offset, $count = false, $searchParams = null)
Get products for category with pagination
at line 682
array
sortProductsInCategory(int $categoryId, int $productId, int $newIndex, bool $hasPriority)
Sort products inside category
at line 715
mixed
getCategoryFilterPricesByCategory(int $id)
Get category filter prices by category
at line 727
mixed
saveTreeCategoryForAdd(Category $category, bool $isCmdAdd = false)
Save tree category for add can be used from cmd
at line 778
array|string
getCatsAsTreeForBackend()
Get category tree for backend
at line 800
mixed
editCatTree(Category $newCategory, mixed $positionChanged, Category $previous, mixed $removedGalleryImages)
Edit category tree
at line 940
removeImageFromDb(Image $image)
Remove image from database
at line 949
setExternalLinksImages(Category $category)
Set external category link images
at line 973
int
deleteTreeCategories(array $ids)
Delete category from tree structure
at line 1038
array|string
getAllTreeCategories(array $options, bool|false $displayNonVisible = false)
Get all categories for tree
at line 1052
array|string
getAllTreeCategoriesForCategoryAddTree()
Get all tree categories for add category page
at line 1080
array|null|string
getAllTreeCategoriesWithPagination(int|string $id, bool $withRoot, array $options, array $additionalCategories)
at line 1114
array
getLftRgtData($cat)
at line 1126
mixed
seCashCategoryTree(string $data, string $locale = null)
Set category tree to cache
at line 1135
mixed
getCashCategoryTree()
Get category tree from cache
at line 1144
mixed
getMegaMenuCashCategoryTree()
Get megamenu tree form cache
at line 1153
mixed
getAllCatsForFrontend()
Get all categories for frontend
at line 1167
mixed
setCacheMegaMenuCategoryTree(string $data, string $locale = null)
Set megamenu categories tree to cache
at line 1175
dispatchTeeGenerateSignal()
This method sends signal for cashing html tree of categories
at line 1186
dispatchCategoryChangeSignal(array $categories, null $mainCategory = null, null $oldCategory = null)
This method sends category has changed (edit or delete)
at line 1195
Translator
getTranslator()
Returns translator service
at line 1207
string
generateRoute(string $routeName, array $data)
Generate route by name with provided data
at line 1218
mixed
getCategoryObjectsById(array $array)
Get category objects by id
at line 1229
mixed
getFilterForCat(string $slug)
Get category filter for category with slug
at line 1241
mixed
getSuggestedPrices(int $categoryId)
Get suggested prices for category filter by products in that category
at line 1260
mixed
getSuggestedBrandsIds(int $categoryId)
Get suggested brands for category filter
at line 1268
dispatchPromoProductsReCache()
Dispatch promo products cache remove - category of product ca be hidden
at line 1277
dispatchCategoryDisplayChange(Category $category)
Dispatch promo products cache remove - category of product ca be hidden
at line 1286
dispatchGroupProductsUpdate(ProductGroupEvent $productGroupEvent)
Dispatch product group event
at line 1297
boolean
updateDisplayForSubCats(Category $rootCategory)
Update display for subcategories of root given category
at line 1308
CategoryEvent
dispatchCategoryTreeDecoratorEvent(string $locale)
Dispatch category tree decorator event with locale argument
at line 1317
EventWithResult|Event
dispatchCategoryTreeConditionsEvent()
Dispatch category tree conditions event
at line 1334
array
getProducts(string $slug, mixed $newCategory, null $productName = null, bool $isCountSearch = false, array $additionalData = [], int $page = 1, int $offset = 12)
Get products by category slug
at line 1363
array
doProductSearch(ProductSearchWrapper $searchWrapper)
Perform product search
at line 1379
array
doProductSearchCount(ProductSearchWrapper $searchWrapper)
Perform product count
at line 1388
mixed
getSearchSettings()
Get search settings from database
at line 1399
CategoryPageEvent
dispatchCategoryEvent(ProductSearchWrapper $searchWrapper)
Dispatch category event
at line 1408
array|string
updateFromCMD()
Update categories from cmd
at line 1423
bool
updateHasVisibleCategories(null $category = null, null $oldParent = null)
Update parent category visibility depending on child categories
at line 1463
array
getCategoryFieldsFromMetadata()
Get category fields from entity metadata
at line 1473
array
getCategoryFieldsForCSVImport()
Get category fields for CSV import Logic when we import categories with name, title, description, parent, etc.
..
at line 1494
mixed
getCategoryParentImportType()
Get category parent import options for CSV import
at line 1503
mixed
getDBSettingsFields()
Get settings fileds from database
at line 1514
mixed
getCustomCategoryFieldsForExport(array $fields)
Get custom category fields for category export
at line 1538
mixed
getCategoryFromRequestSlug()
Get category slug from request
at line 1547
null|object
getCurrentActiveCategory()
Get category from request slug
at line 1560
array
getAvailableLanguages()
Get available languages
at line 1569
dispatchGenerateTranslationSignal(mixed $responseArray)
Dispatch generate translations signal
at line 1582
mixed
getParentImageWebPathForCategory(int $id)
Get parent image path for category with provided id
at line 1596
mixed
getExternalImageByCatId(int $id)
Get external image by category id
at line 1610
mixed
getExternalParentImageByCatId(int $id)
Get external parent image by category id
at line 1620
mixed
setAllCategoriesToCache()
Set all categories (id and name) to cache
at line 1630
setFooterLayoutToCash()
Set footer layout to cache
at line 1639
setNewRequest(Request $request)
Add new request to request stack
at line 1656
array
searchCategories(Filter $filter, int $page = 1, int $offset = 16, array $ignoreIds = [], null $category = null)
Search categories using Filter and pagination data
at line 1666
array
getAllCategoriesIdAndCode()
Get category id and category code
at line 1679
bool|string
saveMultiple(array $categories, int $flushNumber = 30, bool $hasNewCategories = false)
Save multiple categories
at line 1690
mixed
getCategoryReference(int $id)
Get category object reference by id
at line 1701
dispatchMenuUpdateRemoveSignal(int|string $id, int|string $slug, string|null $name = null)
Dispatch menu update remove signal with id, slug and name
at line 1713
dispatchProductsPermissionsUpdateSignal(array $categories)
Dispatch product permissions update signal
at line 1730
bool
updateProductPermissionsForCategories(string $categories)
Param $categories is a string, example "1,2,4,15"
at line 1739
bool
clearTreeQueryResultCache()
Clear tree query result cache
at line 1748
mixed
getCurrentUser()
Get current logged user
at line 1759
mixed
editFields(Category $category)
Edit category fields for provided category
at line 1772
mixed
getHighestLevelParent(Category $category)
Get highest level parent for category
at line 1783
EventWithResult
createRegexEvent(string $regex)
Create regex event
at line 1794
Category
updateCategoryFields(Category $category)
Update category fileds for provided category
at line 1812
bool
mergeMultiple(array $categories)
at line 1824
hideCategoriesForSlug(string $slug, bool $hide = true)
Update hide from menu property to provided state on categories that match provided slug
at line 1833
protected
deleteImagesFromCatGallery(array $images)
Delete Images from category gallery
at line 1861
protected
setGalleryImage(Category $category, Image $image)
Add image to category gallery
at line 1879
protected
setGalleryImages(Category $category, array $images)
Set gallery images to category