Hi,

On symfony-fr groups, many people ask about defaultIdMethod. I try to
set it in a schema.yml :

propel:
  _attributes:     { defaultIdMethod: none }

  myTable:
    colum:          type

I call pake task propel-build-sql and I get error :

propel > sql-template:
[propel-sql] Processing: generated-schema.xml
[propel-sql] Writing to SQL file: /home/ioo/Web/jeanmichelrenault/data/
sql/lib.model.schema.sql
[propel-sql]    + common [builder: MysqlDDLBuilder]
Execution of target "sql-template" failed for the following reason: /
usr/share/php/symfony/vendor/propel-generator/build-propel.xml:187:1:
You have specified autoIncrement for column 'id' but you have not
specified idMethod="native" for table 'common'.
[phingcall] /usr/share/php/symfony/vendor/propel-generator/build-
propel.xml:187:1: You have specified autoIncrement for column 'id' but
you have not specified idMethod="native" for table 'common'.

BUILD FINISHED

I find that error come from yml to xml conversion.

In file sfPropelDatabaseSchema.class.php function fixYAMLDatabase()
( line 140 ) set by default defaultIdMethod to native or set the value
passed in schema.yml.
So as I do in schema.yml, xml file is good.

<database defaultPhpNamingMethod="underscore" heavyIndexing="false"
name="propel" defaultIdMethod="none" noXsd="true" package="lib.model">

But fixYAMLColumns() method ( line 204 ) creates automatically an
default id without take care about database attributes, so the pake
task have error.

I change if conditions in line 275 from :
if (!$has_primary_key )

to
if (!$has_primary_key && $this->database['_attributes']
['defaultIdMethod'] == 'native')

The pake task works fine now.

But I have one question. Do I have to think that defaultIdMethod is
set to database exclusively, or that it could be set for each tables
of database independently ?

Sincerely
Lionel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to