original_string: public function parentRelations(array $relations): ModelList
      {
          $this->main['parents'] = [];
  
          foreach ($relations as $key => $value) {
  
              if (is_string($key)) {
                  $parent = [
                      'relation' => $key,
                      'field'    => $value,
                  ];
              } else {
                  $parent = [
                      'relation' => $value,
                      'field'    => $value,
                  ];
              }
  
              $this->main['parents'][] = $parent;
          }
  
          return $this;
      }
code: public function parentRelations(array $relations): ModelList
      {
          $this->main['parents'] = [];
  
          foreach ($relations as $key => $value) {
  
              if (is_string($key)) {
                  $parent = [
                      'relation' => $key,
                      'field'    => $value,
                  ];
              } else {
                  $parent = [
                      'relation' => $value,
                      'field'    => $value,
                  ];
              }
  
              $this->main['parents'][] = $parent;
          }
  
          return $this;
      }
code_tokens: public function parentRelations ( array $ relations ) : ModelList { $ this -> main [ 'parents' ] = [ ] ; foreach ( $ relations as $ key => $ value ) { if ( is_string ( $ key ) ) { $ parent = [ 'relation' => $ key , 'field' => $ value , ] ; } else { $ parent = [ 'relation' => $ value , 'field' => $ value , ] ; } $ this -> main [ 'parents' ] [ ] = $ parent ; } return $ this ; }
docstring: List parents for list hierarchy handling
  
  The relations by which this listing may be 'filtered'.
  
  @param string[] $relations  either relation names, or key-value pairs: relation => field
  @return ModelList|$this
docstring_tokens: List parents for list hierarchy handling