findBelongsToMany() public method

Find the BelongsToMany relations and add them to associations list
public findBelongsToMany ( Table $model, array $associations ) : array
$model Cake\ORM\Table Model instance being generated
$associations array Array of in-progress associations
return array Associations with belongsToMany added in.
Ejemplo n.º 1
0
 /**
  * Test that HABTM generation works
  *
  * @return void
  */
 public function testHasAndBelongsToManyGeneration()
 {
     $this->Task->connection = 'test';
     $model = TableRegistry::get('BakeArticles');
     $result = $this->Task->findBelongsToMany($model, []);
     $expected = ['belongsToMany' => [['alias' => 'BakeTags', 'foreignKey' => 'bake_article_id', 'joinTable' => 'bake_articles_bake_tags', 'targetForeignKey' => 'bake_tag_id']]];
     $this->assertEquals($expected, $result);
 }