Find the BelongsToMany relations and add them to associations list
public findBelongsToMany ( |
||
$model | Model instance being generated | |
$associations | array | Array of in-progress associations |
리턴 | array | Associations with belongsToMany added in. |
/** * 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); }