Hi All,

I've just started using symfony and I'm liking what I'm seeing so  
far, so thanks for all the effort.

I've just hooked up the sfDoctrine plugin, as outlined at:

http://www.symfony-project.com/trac/wiki/sfDoctrine

(symfony v1.0.0, sfDoctrinePlugin r3589)

I've noticed a couple of issues with the model generator (doctrine- 
build-model) - I figured it was overkill to sign up for a Trac  
account for these two bugs - let me know if you'd prefer that instead  
of posting here.

1. The sfDoctrine webpage above shows "email: true" as an example  
validator property in schema.yml - however, 'email' is missing from  
the $allowedConstraints array of sfDoctrineColumnSchema so this is  
actually ignored during generation.

2. 'columnName' is set as a property of sfDoctrineColumnSchema even  
if it doesn't exist in the schema - this results in a whole bunch of  
"'columnName' => NULL" entries in the generated classes, which then  
choke during Doctrine validation.

The following patch addresses these two issues (line breaks will make  
this messy no doubt)

Cheers,

Michael

Index: addon/sfDoctrineColumnSchema.class.php
===================================================================
--- addon/sfDoctrineColumnSchema.class.php      (revision 3589)
+++ addon/sfDoctrineColumnSchema.class.php      (working copy)
@@ -66,7 +66,7 @@
      'array' => 100,
    );
-  static $allowedConstraints = array('primary', 'autoincrement',  
'default', 'enum', 'unique', 'nospace', 'notblank', 'notnull');
+  static $allowedConstraints = array('primary', 'autoincrement',  
'default', 'enum', 'unique', 'nospace', 'notblank', 'notnull', 'email');
    // column properties: name, size, type and constraints
    protected $properties;
@@ -125,7 +125,11 @@
      // name
      $this->setProperty('name', $colName);
-    $this->setProperty('columnName', $columnInfo->get('columnName'));
+    // alias
+    if ($columnInfo->has('columnName'))
+    {
+      $this->setProperty('columnName', $columnInfo->get('columnName'));
+    }
      // type
      if (!($type = $columnInfo->get('type')))
@@ -282,7 +286,7 @@
      }
      $columnAlias = '';
-    if ($props['columnName'])
+    if (array_key_exists('columnName', $props))
      {
        $columnAlias = $props['columnName'] . ' as ';
        unset($props['columnName']);


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

Reply via email to