original_string: protected function validateParentCategory()
      {
          $field = 'parent_id';
          $value = $this->getSubmitted($field);
  
          if (empty($value)) {
              return null;
          }
  
          $label = $this->translation->text('Parent category');
  
          if (!is_numeric($value)) {
              $this->setErrorNumeric($field, $label);
              return false;
          }
  
          $category = $this->getSubmitted('category');
  
          if (isset($category['category_id']) && $category['category_id'] == $value) {
              $this->setErrorInvalid($field, $label);
              return false;
          }
  
          $parent_category = $this->category->get($value);
  
          if (empty($parent_category['category_id'])) {
              $this->setErrorUnavailable($field, $label);
              return false;
          }
  
          return true;
      }
code: protected function validateParentCategory()
      {
          $field = 'parent_id';
          $value = $this->getSubmitted($field);
  
          if (empty($value)) {
              return null;
          }
  
          $label = $this->translation->text('Parent category');
  
          if (!is_numeric($value)) {
              $this->setErrorNumeric($field, $label);
              return false;
          }
  
          $category = $this->getSubmitted('category');
  
          if (isset($category['category_id']) && $category['category_id'] == $value) {
              $this->setErrorInvalid($field, $label);
              return false;
          }
  
          $parent_category = $this->category->get($value);
  
          if (empty($parent_category['category_id'])) {
              $this->setErrorUnavailable($field, $label);
              return false;
          }
  
          return true;
      }
code_tokens: protected function validateParentCategory ( ) { $ field = 'parent_id' ; $ value = $ this -> getSubmitted ( $ field ) ; if ( empty ( $ value ) ) { return null ; } $ label = $ this -> translation -> text ( 'Parent category' ) ; if ( ! is_numeric ( $ value ) ) { $ this -> setErrorNumeric ( $ field , $ label ) ; return false ; } $ category = $ this -> getSubmitted ( 'category' ) ; if ( isset ( $ category [ 'category_id' ] ) && $ category [ 'category_id' ] == $ value ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ parent_category = $ this -> category -> get ( $ value ) ; if ( empty ( $ parent_category [ 'category_id' ] ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } return true ; }
docstring: Validates parent category group ID
  @return boolean|null
docstring_tokens: Validates parent category group ID