|
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Protected Attributes | |
| $_tree | |
| $_categoryProductTable | |
| $_isActiveAttributeId = null | |
| $_storeId = null | |
| $_eventManager = null | |
| $_categoryCollectionFactory | |
| $_categoryTreeFactory | |
| $entityManager | |
| $aggregateCount | |
Protected Attributes inherited from AbstractResource | |
| $_storeManager | |
| $_modelFactory | |
Protected Attributes inherited from AbstractEntity | |
| $attributeLoader | |
| $connectionName | |
| $_type | |
| $_attributesByCode = [] | |
| $_attributesByTable = [] | |
| $_staticAttributes = [] | |
| $_entityTable | |
| $_describeTable = [] | |
| $_entityIdField | |
| $linkIdField | |
| $_valueEntityIdField | |
| $_valueTablePrefix | |
| $_entityTablePrefix | |
| $_isPartialLoad = false | |
| $_isPartialSave = false | |
| $_sortingSetId = null | |
| $_attributeValuesToDelete = [] | |
| $_attributeValuesToSave = [] | |
| $_resource | |
| $_eavConfig | |
| $_attrSetEntity | |
| $_localeFormat | |
| $_resourceHelper | |
| $_universalFactory | |
| $transactionManager | |
| $objectRelationProcessor | |
Protected Attributes inherited from AbstractResource | |
| $serializer | |
| $_logger | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractEntity | |
| static | $_attributeBackendTables = [] |
@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 21 of file Category.php.
| __construct | ( | \Magento\Eav\Model\Entity\Context | $context, |
| \Magento\Store\Model\StoreManagerInterface | $storeManager, | ||
| \Magento\Catalog\Model\Factory | $modelFactory, | ||
| \Magento\Framework\Event\ManagerInterface | $eventManager, | ||
| \Magento\Catalog\Model\ResourceModel\Category\TreeFactory | $categoryTreeFactory, | ||
| \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory | $categoryCollectionFactory, | ||
| Processor | $indexerProcessor, | ||
$data = [], |
|||
| \Magento\Framework\Serialize\Serializer\Json | $serializer = null |
||
| ) |
Category constructor.
| \Magento\Eav\Model\Entity\Context | $context | |
| \Magento\Store\Model\StoreManagerInterface | $storeManager | |
| \Magento\Catalog\Model\Factory | $modelFactory | |
| \Magento\Framework\Event\ManagerInterface | $eventManager | |
| Category\TreeFactory | $categoryTreeFactory | |
| Category\CollectionFactory | $categoryCollectionFactory | |
| Processor | $indexerProcessor | |
| array | $data | |
| \Magento\Framework\Serialize\Serializer\Json | null | $serializer |
Definition at line 104 of file Category.php.
|
protected |
Mark Category indexer as invalid to be picked up by cron.
| DataObject | $object |
Definition at line 216 of file Category.php.
|
protected |
Process category data after save category object save related products ids and update path value
| \Magento\Framework\DataObject | $object |
Add identifier for new category
Definition at line 306 of file Category.php.
|
protected |
Process category data before delete update children count for parent category delete child categories
| \Magento\Framework\DataObject | $object |
Definition at line 203 of file Category.php.
|
protected |
Process category data before saving prepare path and increment children count for parent categories
| \Magento\Framework\DataObject | $object |
Definition at line 259 of file Category.php.
|
protected |
Get maximum position of child categories by specific tree path
| string | $path |
Definition at line 345 of file Category.php.
|
protected |
Retrieve category tree object
Definition at line 187 of file Category.php.
|
protected |
Process positions of old parent category children and new parent category children. Get position for moved category
| \Magento\Catalog\Model\Category | $category | |
| \Magento\Catalog\Model\Category | $newParent | |
| null | int | $afterCategoryId |
Prepare position value
Definition at line 992 of file Category.php.
|
protected |
Save category products relation
| \Magento\Catalog\Model\Category | $category |
new category-product relationships
Example re-save category
old category-product relationships
Find product ids which are presented in both arrays and saved before (check $oldProducts array)
Delete products from category
Add products to category
Update product positions in category
Setting affected products to category for third party engine index refresh
Definition at line 375 of file Category.php.
|
protected |
Update path field
| \Magento\Catalog\Model\Category | $object |
Definition at line 326 of file Category.php.
| changeParent | ( | \Magento\Catalog\Model\Category | $category, |
| \Magento\Catalog\Model\Category | $newParent, | ||
$afterCategoryId = null |
|||
| ) |
Move category to another parent node
| \Magento\Catalog\Model\Category | $category | |
| \Magento\Catalog\Model\Category | $newParent | |
| null | int | $afterCategoryId |
Decrease children count for all old category parent categories
Increase children count for new category parents
Update children nodes path
Update moved category data
Definition at line 913 of file Category.php.
| checkId | ( | $entityId | ) |
Check if category id exist
| int | $entityId |
Definition at line 517 of file Category.php.
| countVisible | ( | ) |
Get total number of persistent categories in the system, excluding the default category
Definition at line 1028 of file Category.php.
| delete | ( | $object | ) |
{}
Definition at line 1067 of file Category.php.
| deleteChildren | ( | \Magento\Framework\DataObject | $object | ) |
Delete children categories of specific category
| \Magento\Framework\DataObject | $object |
Add deleted children ids to object This data can be used in after delete event
Definition at line 228 of file Category.php.
| findWhereAttributeIs | ( | $entityIdsFilter, | |
| $attribute, | |||
| $expectedValue | |||
| ) |
Return entities where attribute value is
| array | int | $entityIdsFilter | |
| \Magento\Eav\Model\Entity\Attribute | $attribute | |
| mixed | $expectedValue |
Definition at line 617 of file Category.php.
| getAllChildren | ( | $category | ) |
Return all children ids of category (with category id)
| \Magento\Catalog\Model\Category | $category |
Definition at line 841 of file Category.php.
| getCategories | ( | $parent, | |
$recursionLevel = 0, |
|||
$sorted = false, |
|||
$asCollection = false, |
|||
$toLoad = true |
|||
| ) |
Retrieve categories
| integer | $parent | |
| integer | $recursionLevel | |
| boolean | string | $sorted | |
| boolean | $asCollection | |
| boolean | $toLoad |
Definition at line 680 of file Category.php.
| getCategoryPathById | ( | $categoryId | ) |
Get category path value by its id
| int | $categoryId |
Definition at line 892 of file Category.php.
| getCategoryProductTable | ( | ) |
Category product table name getter
Definition at line 149 of file Category.php.
| getChildren | ( | $category, | |
$recursive = true |
|||
| ) |
Return children ids of category
| \Magento\Catalog\Model\Category | $category | |
| boolean | $recursive |
Definition at line 798 of file Category.php.
| getChildrenAmount | ( | $category, | |
$isActiveFlag = true |
|||
| ) |
Get count of active/not active children categories
| \Magento\Catalog\Model\Category | $category | |
| bool | $isActiveFlag |
Definition at line 560 of file Category.php.
| getChildrenCategories | ( | $category | ) |
Return child categories
| \Magento\Catalog\Model\Category | $category |
Definition at line 766 of file Category.php.
| getChildrenCount | ( | $categoryId | ) |
Get children categories count
| int | $categoryId |
Definition at line 498 of file Category.php.
| getEntityType | ( | ) |
Entity type getter and lazy loader
Definition at line 136 of file Category.php.
| getIsActiveAttributeId | ( | ) |
Get "is_active" attribute identifier
Definition at line 599 of file Category.php.
| getParentDesignCategory | ( | $category | ) |
Return parent category of current category with own custom design settings
| \Magento\Catalog\Model\Category | $category |
Definition at line 726 of file Category.php.
| getProductCount | ( | $category | ) |
Get products count in category
| \Magento\Catalog\Model\Category | $category |
Definition at line 653 of file Category.php.
| getProductsPosition | ( | $category | ) |
Get positions of associated to category products
| \Magento\Catalog\Model\Category | $category |
Definition at line 479 of file Category.php.
| getStoreId | ( | ) |
| isForbiddenToDelete | ( | $categoryId | ) |
Check category is forbidden to delete. If category is root and assigned to store group return false
| integer | $categoryId |
Definition at line 870 of file Category.php.
| isInRootCategoryList | ( | $category | ) |
Check is category in list of store categories
| \Magento\Catalog\Model\Category | $category |
Definition at line 856 of file Category.php.
| load | ( | $object, | |
| $entityId, | |||
$attributes = [] |
|||
| ) |
Reset firstly loaded attributes
| \Magento\Framework\DataObject | $object | |
| integer | $entityId | |
| array | null | $attributes |
Definition at line 1044 of file Category.php.
| save | ( | \Magento\Framework\Model\AbstractModel | $object | ) |
Save entity's attributes into the object's resource
| \Magento\Framework\Model\AbstractModel | $object |
Definition at line 1084 of file Category.php.
| setStoreId | ( | $storeId | ) |
| verifyIds | ( | array | $ids | ) |
Check array of category identifiers
| array | $ids |
Definition at line 536 of file Category.php.
|
protected |
Definition at line 68 of file Category.php.
|
protected |
Definition at line 35 of file Category.php.
|
protected |
Definition at line 75 of file Category.php.
|
protected |
Definition at line 61 of file Category.php.
|
protected |
Definition at line 47 of file Category.php.
|
protected |
Definition at line 54 of file Category.php.
|
protected |
Definition at line 28 of file Category.php.
|
protected |
Definition at line 85 of file Category.php.
|
protected |
Definition at line 80 of file Category.php.