Development

#3124 ([PATCH] sfPropelDatabaseSchema.class.php doesn't convert column attributes)

You must first sign up to be able to contribute.

Ticket #3124 (closed defect: fixed)

Opened 9 months ago

Last modified 9 months ago

[PATCH] sfPropelDatabaseSchema.class.php doesn't convert column attributes

Reported by: svewap Assigned to: francois
Priority: minor Milestone: 1.1.0
Component: plugins Version: 1.1.0 DEV
Keywords: Cc:
Qualification: Unreviewed

Description

Attributes like PrimaryKey? are not converted from yml file to xml file.

Index: lib/plugins/sfPropelPlugin/lib/propel/sfPropelDatabaseSchema.class.php =================================================================== --- lib/plugins/sfPropelPlugin/lib/propel/sfPropelDatabaseSchema.class.php (Revision 7905) +++ lib/plugins/sfPropelPlugin/lib/propel/sfPropelDatabaseSchema.class.php (Arbeitskopie) @@ -616,7 +616,7 @@

$booleans = array('required', 'primaryKey', 'autoincrement', 'autoIncrement', 'noXsd', 'isI18N', 'isCulture'); if (in_array($key, $booleans)) {

- return $value == 1 ? 'true' : 'false'; + return ((boolean)$value == true) ? 'true' : 'false';

} else {

Attachments

schema.yml (0.9 kB) - added by svewap on 03/16/08 13:12:21.
example yml schema

Change History

03/16/08 01:47:25 changed by svewap

  • milestone set to 1.1.0.

03/16/08 09:27:08 changed by francois

  • owner changed from fabien to francois.

It works for me. Do you have an example YAML schema for which it doesn't work?

03/16/08 13:12:21 changed by svewap

  • attachment schema.yml added.

example yml schema

03/16/08 13:25:12 changed by svewap

type of var $value is sometimes boolean, integer and string.

03/16/08 23:20:04 changed by francois

  • status changed from new to closed.
  • resolution set to invalid.
primaryKey: 'true'

Then it's a problem with the YAML Parser. Whatever the value you write in your YAML, the value sent by the parser must be 0 or 1 if your syntax follows the YAML spec.

So I don't know which parser you are using, but that's another problem, unrelated to sfPropelDatabaseSchema.

03/16/08 23:28:53 changed by svewap

Then please fix your YAML parser. Im only using your 1.1 branch, nothing special.

03/17/08 00:30:27 changed by francois

Which version (release number) of symfony are you using? The YAML parser is changing a lot lately. I suggest you update to the latest revision and check if the problem still appears.

03/17/08 00:57:49 changed by svewap

I'm using the latest. Revision 7925 now. I've updated it and tried to build the models again. I'm using the latest php version.

If I comment the unlink xml schema command in the propel:build-schema task and check the xml-file, all attributes are set correctly. So the attributes are not transfered correctly from yml-file to generated-schema-transformed.xml.

03/17/08 09:16:26 changed by francois

  • status changed from closed to reopened.
  • resolution deleted.

Ok, I understand your problem better. The problem is not with the interpretation of the YAML, but with the translation of the XML to the YAML. The sfPropelDatabaseSchema class transforms the following XML:

 <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />

To the following YAML line:

 id: { type: integer, required: 'true', primaryKey: 'true', autoIncrement: 'true' }

Instead of

 id: { type: integer, required: true, primaryKey: true, autoIncrement: true }

03/17/08 09:28:37 changed by francois

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [7928]) [1.1] Fixed problem with YAML schema generation from XML with booleans (closes #3124)