Form Generation : M2M false recognition #88

Closed
jaugustin opened this Issue Oct 13, 2011 · 4 comments

4 participants

@jaugustin
Propel member

Hi,

Today the Form generator automaticaly detect Many to Many relation:

A table is considered to be a m2m table if it has 2 foreign keys that are also primary keys.

It generate multiple list in the form for table related to a M2M.

Or if the M2M contain extra fields (another PK field or other fields) it should'nt generate the multiple liste because it will never work and break the table.

https://github.com/propelorm/sfPropelORMPlugin/blob/master/lib/generator/sfPropelGenerator.class.php#L66

I think it should test that the table has only 2 fields.

I could try to provide a PR

@fzaninotto
Propel member

The logic from sfPropelGenerator should be rewritten to use real man,y-to-many relationships, ie declared using a crossRef table in the schema.

@themouette
Propel member
@themouette
Propel member
@jaugustin
Propel member

I talk with @fzaninotto and he find a better way to do the getManyToManyTables. The isCrossRef attribute is not needed anymore.

I will write a new PR.

What will do the "new" getManyToManyTables:

Get Many To Many relations of the current table
Find the common table (crossRef)
Build the table array.

@jaugustin jaugustin added a commit to jaugustin/sfPropelORMPlugin that referenced this issue Mar 11, 2012
@jaugustin jaugustin Propel Generator: for getManyToManyTables use real ManyToMany, fixes #88
fc97215
@komapa komapa added a commit to CollectorsQuest/sfPropelORMPlugin that referenced this issue Mar 28, 2012
@komapa komapa Merge remote-tracking branch 'upstream/master'
* upstream/master:
  Update propel to 1.6.5
  Fix CS
  Make the xmlhttp in POST to enable explain on big queries
  Enable to show the explanation for a query in the symfony debug bar
  fix wrong version of sfPropelORMPlugin, fix last non cross platform directory separator
  fix tests and add new tests for many to many handle with isCrossref parameter
  made test installer cross platform
  Propel Generator: for getManyToManyTables use real ManyToMany, fixes #88
  Fixed tests thanks to travis-ci
  [Tests] Fixed submodules issue
  Fix: backported the PR #110 from the PropelBundle, which fixes the handling of array type in data loader
  Revert "keep locale default value in the i18n objects
  Fixed CS
  Test for Enum Values with spaces
  Fix to avoid problems on enumerated values that contains with spaces inner the value
  Fixed installer for the test suite, now you can run the 'prepare_tests.sh' script, and test your code.
  keep locale default value in the i18n objects see mazenovi/sfPropelORMPlugin@b353abc
  update propel lib to last master rev

Conflicts:
	lib/vendor/propel
d503194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment