original_string: protected function _associations(array $whitelist = [])
      {
          $table = $this->_table();
  
          $associationConfiguration = [];
  
          $associations = $table->associations();
  
          $keys = $associations->keys();
          if (!empty($whitelist)) {
              $keys = array_intersect($keys, array_map('strtolower', $whitelist));
          }
          foreach ($keys as $associationName) {
              $association = $associations->get($associationName);
              $type = $association->type();
  
              if (!isset($associationConfiguration[$type])) {
                  $associationConfiguration[$type] = [];
              }
  
              $assocKey = $association->getName();
              $associationConfiguration[$type][$assocKey]['model'] = $assocKey;
              $associationConfiguration[$type][$assocKey]['type'] = $type;
              $associationConfiguration[$type][$assocKey]['primaryKey'] = $association->getTarget()->getPrimaryKey();
              $associationConfiguration[$type][$assocKey]['displayField'] = $association->getTarget()->getDisplayField();
              $associationConfiguration[$type][$assocKey]['foreignKey'] = $association->getForeignKey();
              $associationConfiguration[$type][$assocKey]['propertyName'] = $association->getProperty();
              $associationConfiguration[$type][$assocKey]['plugin'] = pluginSplit($association->getClassName())[0];
              $associationConfiguration[$type][$assocKey]['controller'] = $assocKey;
              $associationConfiguration[$type][$assocKey]['entity'] = Inflector::singularize(Inflector::underscore($assocKey));
              $associationConfiguration[$type][$assocKey]['entities'] = Inflector::underscore($assocKey);
  
              $associationConfiguration[$type][$assocKey] = array_merge($associationConfiguration[$type][$assocKey], $this->_action()->getConfig('association.' . $assocKey) ?: []);
          }
  
          return $associationConfiguration;
      }
code: protected function _associations(array $whitelist = [])
      {
          $table = $this->_table();
  
          $associationConfiguration = [];
  
          $associations = $table->associations();
  
          $keys = $associations->keys();
          if (!empty($whitelist)) {
              $keys = array_intersect($keys, array_map('strtolower', $whitelist));
          }
          foreach ($keys as $associationName) {
              $association = $associations->get($associationName);
              $type = $association->type();
  
              if (!isset($associationConfiguration[$type])) {
                  $associationConfiguration[$type] = [];
              }
  
              $assocKey = $association->getName();
              $associationConfiguration[$type][$assocKey]['model'] = $assocKey;
              $associationConfiguration[$type][$assocKey]['type'] = $type;
              $associationConfiguration[$type][$assocKey]['primaryKey'] = $association->getTarget()->getPrimaryKey();
              $associationConfiguration[$type][$assocKey]['displayField'] = $association->getTarget()->getDisplayField();
              $associationConfiguration[$type][$assocKey]['foreignKey'] = $association->getForeignKey();
              $associationConfiguration[$type][$assocKey]['propertyName'] = $association->getProperty();
              $associationConfiguration[$type][$assocKey]['plugin'] = pluginSplit($association->getClassName())[0];
              $associationConfiguration[$type][$assocKey]['controller'] = $assocKey;
              $associationConfiguration[$type][$assocKey]['entity'] = Inflector::singularize(Inflector::underscore($assocKey));
              $associationConfiguration[$type][$assocKey]['entities'] = Inflector::underscore($assocKey);
  
              $associationConfiguration[$type][$assocKey] = array_merge($associationConfiguration[$type][$assocKey], $this->_action()->getConfig('association.' . $assocKey) ?: []);
          }
  
          return $associationConfiguration;
      }
code_tokens: protected function _associations ( array $ whitelist = [ ] ) { $ table = $ this -> _table ( ) ; $ associationConfiguration = [ ] ; $ associations = $ table -> associations ( ) ; $ keys = $ associations -> keys ( ) ; if ( ! empty ( $ whitelist ) ) { $ keys = array_intersect ( $ keys , array_map ( 'strtolower' , $ whitelist ) ) ; } foreach ( $ keys as $ associationName ) { $ association = $ associations -> get ( $ associationName ) ; $ type = $ association -> type ( ) ; if ( ! isset ( $ associationConfiguration [ $ type ] ) ) { $ associationConfiguration [ $ type ] = [ ] ; } $ assocKey = $ association -> getName ( ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'model' ] = $ assocKey ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'type' ] = $ type ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'primaryKey' ] = $ association -> getTarget ( ) -> getPrimaryKey ( ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'displayField' ] = $ association -> getTarget ( ) -> getDisplayField ( ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'foreignKey' ] = $ association -> getForeignKey ( ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'propertyName' ] = $ association -> getProperty ( ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'plugin' ] = pluginSplit ( $ association -> getClassName ( ) ) [ 0 ] ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'controller' ] = $ assocKey ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'entity' ] = Inflector :: singularize ( Inflector :: underscore ( $ assocKey ) ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] [ 'entities' ] = Inflector :: underscore ( $ assocKey ) ; $ associationConfiguration [ $ type ] [ $ assocKey ] = array_merge ( $ associationConfiguration [ $ type ] [ $ assocKey ] , $ this -> _action ( ) -> getConfig ( 'association.' . $ assocKey ) ? : [ ] ) ; } return $ associationConfiguration ; }
docstring: Returns associations for controllers models.
  
  @param array $whitelist Whitelist of associations to return.
  @return array Associations for model
docstring_tokens: Returns associations for controllers models .