Permalink
Browse files

Merge pull request #215 from Tschebel/master

Many2Many Table with more than 2 Columns BC break
  • Loading branch information...
2 parents ab88a6b + 06d6649 commit 2ee6fd6d34ab9244b7206823c1b7aa6ec2b85f11 @willdurand willdurand committed Dec 16, 2013
Showing with 6 additions and 8 deletions.
  1. +0 −2 lib/generator/sfPropelFormGenerator.class.php
  2. +6 −6 test/functional/formTest.php
@@ -182,11 +182,9 @@ public function getManyToManyTables()
//check if $middleTable is a Many 2 Many :
// exclude already found middle table
// if there it has 2 PKs
- // if there id only 2 columns in the table
// if PKs are also FKs
if (!isset($middleTables[$middleTable->getClassname()])
&& 2 === count($pks = $middleTable->getPrimaryKeyColumns())
- && 2 === count($middleTable->getColumns())
&& $pks[0]->isForeignKey()
&& $pks[1]->isForeignKey())
{
@@ -296,17 +296,17 @@
$form = new SellerForm();
try {
$form->getWidget('sale_list');
- $b->test()->fail('The seller form shoud not has sale_list field because it is not a many to many relation');
+ $b->test()->pass('The seller form should have sale_list field because it is a many to many relation');
} catch (InvalidArgumentException $e) {
- $b->test()->pass('The seller form shoud not has sale_list field because it is not a many to many relation');
+ $b->test()->fail('The seller form should have sale_list field because it is a many to many relation');
}
$form = new BookForm();
try {
$form->getWidget('sale_list');
- $b->test()->fail('The book form shoud not has sale_list field because it is not a many to many relation');
+ $b->test()->pass('The book form should have sale_list field because it is a many to many relation');
} catch (InvalidArgumentException $e) {
- $b->test()->pass('The book form shoud not has sale_list field because it is not a many to many relation');
+ $b->test()->fail('The book form should have sale_list field because it is a many to many relation');
}
$form = new SellerForm();
@@ -318,8 +318,8 @@
$tooMany->setManyRelatedByManyfkCrossId($many);
$tooMany->setManyRelatedByManyfkId($many2);
$many->save();
-$form = new ManyForm($many);
-$b->test()->isa_ok($form->getWidget('too_many_list'), 'sfWidgetFormPropelChoice', 'The Many form should have a sfWidgetFormPropelChoice of Many when there is a isCrossRef on a middle table');
+$form = new ManyForm($many);
+$b->test()->isa_ok($form->getWidget('too_many_list'), 'sfWidgetFormPropelChoice', 'The Many form should have a sfWidgetFormPropelChoice of Many when there is a isCrossRef on a middle table');
try {
// PHP Fatal if it fail

0 comments on commit 2ee6fd6

Please sign in to comment.