original_string: public function setCategory($category, $preserveDefault = false, $includeSubcategories = false)
      {
          /** @var Model $model */
          $model = $this->framework->getAdapter(Model::class);
  
          // Include the subcategories
          if ($includeSubcategories) {
              /** @var NewsCategoryModel $newsCategoryModel */
              $newsCategoryModel = $this->framework->getAdapter(NewsCategoryModel::class);
              $category = $newsCategoryModel->getAllSubcategoriesIds($category);
          }
  
          $newsIds = $model->getReferenceValues('tl_news', 'categories', $category);
          $newsIds = $this->parseIds($newsIds);
  
          if (0 === \count($newsIds)) {
              throw new NoNewsException();
          }
  
          // Do not preserve the default categories
          if (!$preserveDefault) {
              unset($this->columns['defaultCategories']);
          }
  
          $t = $this->getNewsModelAdapter()->getTable();
  
          $this->columns[] = "$t.id IN(".\implode(',', $newsIds).')';
      }
code: public function setCategory($category, $preserveDefault = false, $includeSubcategories = false)
      {
          /** @var Model $model */
          $model = $this->framework->getAdapter(Model::class);
  
          // Include the subcategories
          if ($includeSubcategories) {
              /** @var NewsCategoryModel $newsCategoryModel */
              $newsCategoryModel = $this->framework->getAdapter(NewsCategoryModel::class);
              $category = $newsCategoryModel->getAllSubcategoriesIds($category);
          }
  
          $newsIds = $model->getReferenceValues('tl_news', 'categories', $category);
          $newsIds = $this->parseIds($newsIds);
  
          if (0 === \count($newsIds)) {
              throw new NoNewsException();
          }
  
          // Do not preserve the default categories
          if (!$preserveDefault) {
              unset($this->columns['defaultCategories']);
          }
  
          $t = $this->getNewsModelAdapter()->getTable();
  
          $this->columns[] = "$t.id IN(".\implode(',', $newsIds).')';
      }
code_tokens: public function setCategory ( $ category , $ preserveDefault = false , $ includeSubcategories = false ) { /** @var Model $model */ $ model = $ this -> framework -> getAdapter ( Model :: class ) ; // Include the subcategories if ( $ includeSubcategories ) { /** @var NewsCategoryModel $newsCategoryModel */ $ newsCategoryModel = $ this -> framework -> getAdapter ( NewsCategoryModel :: class ) ; $ category = $ newsCategoryModel -> getAllSubcategoriesIds ( $ category ) ; } $ newsIds = $ model -> getReferenceValues ( 'tl_news' , 'categories' , $ category ) ; $ newsIds = $ this -> parseIds ( $ newsIds ) ; if ( 0 === \ count ( $ newsIds ) ) { throw new NoNewsException ( ) ; } // Do not preserve the default categories if ( ! $ preserveDefault ) { unset ( $ this -> columns [ 'defaultCategories' ] ) ; } $ t = $ this -> getNewsModelAdapter ( ) -> getTable ( ) ; $ this -> columns [ ] = "$t.id IN(" . \ implode ( ',' , $ newsIds ) . ')' ; }
docstring: Set the category.
  
  @param int  $category
  @param bool $preserveDefault
  @param bool $includeSubcategories
  
  @return NoNewsException
docstring_tokens: Set the category .