/**
* Get the array of junction aliases for all the BelongsToMany associations
*
* @param Table $table Table
* @return array junction aliases of all the BelongsToMany associations
*/
public function belongsToManyJunctionAliases(Table $table)
{
$extractor = function ($val) {
return $val->junction()->alias();
};
return array_map($extractor, $table->associations()->type('BelongsToMany'));
}