original_string: protected function _addAssociationsToTypeMap($table, $typeMap, $associations)
      {
          foreach ($associations as $name => $nested) {
              if (!$table->hasAssociation($name)) {
                  continue;
              }
              $association = $table->getAssociation($name);
              $target = $association->getTarget();
              $primary = (array)$target->getPrimaryKey();
              if (empty($primary) || $typeMap->type($target->aliasField($primary[0])) === null) {
                  $this->addDefaultTypes($target);
              }
              if (!empty($nested)) {
                  $this->_addAssociationsToTypeMap($target, $typeMap, $nested);
              }
          }
      }
code: protected function _addAssociationsToTypeMap($table, $typeMap, $associations)
      {
          foreach ($associations as $name => $nested) {
              if (!$table->hasAssociation($name)) {
                  continue;
              }
              $association = $table->getAssociation($name);
              $target = $association->getTarget();
              $primary = (array)$target->getPrimaryKey();
              if (empty($primary) || $typeMap->type($target->aliasField($primary[0])) === null) {
                  $this->addDefaultTypes($target);
              }
              if (!empty($nested)) {
                  $this->_addAssociationsToTypeMap($target, $typeMap, $nested);
              }
          }
      }
code_tokens: protected function _addAssociationsToTypeMap ( $ table , $ typeMap , $ associations ) { foreach ( $ associations as $ name => $ nested ) { if ( ! $ table -> hasAssociation ( $ name ) ) { continue ; } $ association = $ table -> getAssociation ( $ name ) ; $ target = $ association -> getTarget ( ) ; $ primary = ( array ) $ target -> getPrimaryKey ( ) ; if ( empty ( $ primary ) || $ typeMap -> type ( $ target -> aliasField ( $ primary [ 0 ] ) ) === null ) { $ this -> addDefaultTypes ( $ target ) ; } if ( ! empty ( $ nested ) ) { $ this -> _addAssociationsToTypeMap ( $ target , $ typeMap , $ nested ) ; } } }
docstring: Used to recursively add contained association column types to
  the query.
  
  @param \Cake\ORM\Table $table The table instance to pluck associations from.
  @param \Cake\Database\TypeMap $typeMap The typemap to check for columns in.
  This typemap is indirectly mutated via Cake\ORM\Query::addDefaultTypes()
  @param array $associations The nested tree of associations to walk.
  @return void
docstring_tokens: Used to recursively add contained association column types to the query .