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.
public addAssociations ( array $params ) : void | ||
$params | array | Set of associations to bind (indexed by association type) |
return | void |