title: Programmatically change 'is_active' of category in Magento 2
body: <p>How can I programmatically change the value of 'is_active' in Magento 2? What I have tried so far (in an observer) is:</p>
  
  <pre><code>class Observer implements ObserverInterface
  {   
      /**
       * @var \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory
       */
      protected $_categoryCollectionFactory;
  
      /**
       * @var \Magento\Catalog\Api\CategoryRepositoryInterface
       */
      protected $_repository;
  
      public function __construct(
              \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory,
              \Magento\Catalog\Api\CategoryRepositoryInterface $repository
      ) {
          $this-&gt;_categoryCollectionFactory = $categoryCollectionFactory;
          $this-&gt;_repository = $repository;
      }
  
      /**
       * @param EventObserver $observer
       * @return void
       */
      public function execute(EventObserver $observer)
      {
          $categoryCollection = $this-&gt;_categoryCollectionFactory-&gt;create();
          $categoryCollection-&gt;addAttributeToSelect('*');
          $categoryCollection-&gt;addAttributeToFilter('name', array('eq' =&gt; 'test'));
          $currentCategory = $categoryCollection-&gt;getFirstItem();
  
          $currentCategory-&gt;setIsActive(true);
          $this-&gt;_repository-&gt;save($currentCategory);
      }
  }
  </code></pre>
  
  <p>The 'is_active' value is not changing. It seems that the only values that can be changed with the magical set functions are the values of the table catalog_category_entity.</p>