cancel
Showing results for 
Search instead for 
Did you mean: 

Recovery id category after insert

Recovery id category after insert

Hello all 

I create category with this script 

 

$categoryFactory=$objectManager->get('\Magento\Catalog\Model\CategoryFactory');

/// Add a new sub category under root category
$categoryTmp = $categoryFactory->create();
$categoryTmp->setName($categorys['des_grumerc']);
$categoryTmp->setIsActive(true);
$categoryTmp->setParentId($rootCat->getId());
$categoryTmp->setStoreId($storeId);
$categoryTmp->setPath($rootCat->getPath());
$categoryTmp->save();

 

 

i would like to recover after insert ,id item of this category 

 

Some advice for my problem ?

 

Thank Alessandro