/**
  * Returns a PHP string representing options to pass to a validator for a given column.
  *
  * @param sfDoctrineColumn $column
  * @return string    The options to pass to the validator as a PHP string
  */
 public function getValidatorOptionsForColumn($column)
 {
     $options = array();
     if ($column->isForeignKey()) {
         if ($foreignColumn = $column->getForeignTable()->getColumnName($column->getForeignFieldName())) {
             $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\'), \'column\' => \'%s\'', $column->getRelationKey('alias'), $foreignColumn);
         } else {
             $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\')', $column->getRelationKey('alias'));
         }
     } else {
         if ($column->isPrimaryKey()) {
             $options[] = sprintf('\'choices\' => array($this->getObject()->get(\'%s\')), \'empty_value\' => $this->getObject()->get(\'%1$s\')', $column->getFieldName());
         } else {
             switch ($column->getDoctrineType()) {
                 case 'string':
                     if ($column['length']) {
                         $options[] = sprintf('\'max_length\' => %s', $column['length']);
                     }
                     if (isset($column['minlength'])) {
                         $options[] = sprintf('\'min_length\' => %s', $column['minlength']);
                     }
                     if (isset($column['regexp'])) {
                         $options[] = sprintf('\'pattern\' => \'%s\'', $column['regexp']);
                     }
                     break;
                 case 'enum':
                     $options[] = '\'choices\' => ' . $this->arrayExport($column['values']);
                     break;
             }
         }
     }
     // If notnull = false, is a primary or the column has a default value then
     // make the widget not required
     if (!$column->isNotNull() || $column->isPrimaryKey() || $column->hasDefinitionKey('default')) {
         $options[] = '\'required\' => false';
     }
     return count($options) ? sprintf('array(%s)', implode(', ', $options)) : '';
 }