original_string: public function addAssociations(array $params)
      {
          foreach ($params as $assocType => $tables) {
              foreach ($tables as $associated => $options) {
                  if (is_numeric($associated)) {
                      $associated = $options;
                      $options = [];
                  }
                  $this->{$assocType}($associated, $options);
              }
          }
  
          return $this;
      }
code: public function addAssociations(array $params)
      {
          foreach ($params as $assocType => $tables) {
              foreach ($tables as $associated => $options) {
                  if (is_numeric($associated)) {
                      $associated = $options;
                      $options = [];
                  }
                  $this->{$assocType}($associated, $options);
              }
          }
  
          return $this;
      }
code_tokens: public function addAssociations ( array $ params ) { foreach ( $ params as $ assocType => $ tables ) { foreach ( $ tables as $ associated => $ options ) { if ( is_numeric ( $ associated ) ) { $ associated = $ options ; $ options = [ ] ; } $ this -> { $ assocType } ( $ associated , $ options ) ; } } return $ this ; }
docstring: Setup multiple associations.
  
  It takes an array containing set of table names indexed by association type
  as argument:
  
  ```
  $this->Posts->addAssociations([
  'belongsTo' => [
  'Users' => ['className' => 'App\Model\Table\UsersTable']
  ],
  'hasMany' => ['Comments'],
  'belongsToMany' => ['Tags']
  ]);
  ```
  
  Each association type accepts multiple associations where the keys
  are the aliases, and the values are association config data. If numeric
  keys are used the values will be treated as association aliases.
  
  @param array $params Set of associations to bind (indexed by association type)
  @return $this
  @see \Cake\ORM\Table::belongsTo()
  @see \Cake\ORM\Table::hasOne()
  @see \Cake\ORM\Table::hasMany()
  @see \Cake\ORM\Table::belongsToMany()
docstring_tokens: Setup multiple associations .