Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
product_with_category_rollback.php
Go to the documentation of this file.
1 <?php
12 
13 $objectManager = Bootstrap::getObjectManager();
16 
17 $registry->unregister('isSecureArea');
18 $registry->register('isSecureArea', true);
19 
20 
22 $productRepository = $objectManager->get(ProductRepositoryInterface::class);
23 //$productRepository->deleteById('p002');
24 $product = $productRepository->get('p002', false, null, true);
26 
28 $searchCriteriaBuilder = $objectManager->get(SearchCriteriaBuilder::class);
29 $searchCriteria = $searchCriteriaBuilder->addFilter('name', 'category 1')
30  ->create();
31 
33 $categoryList = $objectManager->get(CategoryListInterface::class);
35  ->getItems();
36 
38 $categoryRepository = $objectManager->get(CategoryRepositoryInterface::class);
39 
40 foreach ($categories as $category) {
42 }
43 
44 $registry->unregister('isSecureArea');
45 $registry->register('isSecureArea', false);
46 
47 require __DIR__ . '/../../Store/_files/store_rollback.php';
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60