Browse Source

Removing exception that prevented matching and contain in the same association

This type of conflic is not possible anymore
Jose Lorenzo Rodriguez 11 years ago
parent
commit
05434ffd69
2 changed files with 0 additions and 27 deletions
  1. 0 7
      src/ORM/EagerLoader.php
  2. 0 20
      tests/TestCase/ORM/QueryTest.php

+ 0 - 7
src/ORM/EagerLoader.php

@@ -409,13 +409,6 @@ class EagerLoader {
 			return $config;
 		}
 
-		if (!empty($config['config']['matching'])) {
-			throw new \RuntimeException(sprintf(
-				'Cannot use "matching" on "%s" as there is another association with the same alias',
-				$alias
-			));
-		}
-
 		$config['canBeJoined'] = false;
 		$config['config']['strategy'] = $config['instance']::STRATEGY_SELECT;
 	}

+ 0 - 20
tests/TestCase/ORM/QueryTest.php

@@ -1997,26 +1997,6 @@ class QueryTest extends TestCase {
 	}
 
 /**
- * Tests that it is not allowed to use matching on an association
- * that is already added to containments.
- *
- * @expectedException \RuntimeException
- * @expectedExceptionMessage Cannot use "matching" on "Authors" as there is another association with the same alias
- * @return void
- */
-	public function testConflitingAliases() {
-		$this->markTestIncomplete('Needs an actual conflicting case');
-		$table = TableRegistry::get('ArticlesTags');
-		$table->belongsTo('Articles')->target()->belongsTo('Authors');
-		$table->belongsTo('Tags');
-		$table->Tags->target()->hasOne('Authors');
-		$table->find()
-			->contain(['Articles.Authors'])
-			->matching('Tags.Authors')
-			->sql();
-	}
-
-/**
  * Tests that a hasOne association using the select strategy will still have the
  * key present in the results when no match is found
  *