$t->is($column->getName(), 'name');
$t->is($column->getFieldName(), 'name');
$t->is($column->getPhpName(), 'name');
$t->is($column->isNotNull(), true);
$column = new sfDoctrineColumn('test', Doctrine::getTable('Test'));
$t->is($column->getName(), 'test');
$t->is($column->getFieldName(), 'TEST');
$t->is($column->getPhpName(), 'TEST');
$t->is($column->getDoctrineType(), 'string');
$t->is($column->getType(), 'VARCHAR');
$t->is($column->getLength(), 255);
$t->is($column->getSize(), 255);
$t->is($column->hasDefinitionKey('length'), true);
$t->is($column->getDefinitionKey('type'), 'string');
$t->is($column->isNotNull(), false);
// Is not null and has definition key
$column = new sfDoctrineColumn('email', Doctrine::getTable('Test'));
$t->is($column->isNotNull(), true);
$t->is($column->hasDefinitionKey('email'), true);
$t->is($column->getDefinitionKey('email'), true);
// Is primary key
$column = new sfDoctrineColumn('id', Doctrine::getTable('Test'));
$t->is($column->isPrimaryKey(), true);
// Relation/foreign key functions
$column = new sfDoctrineColumn('test_id', Doctrine::getTable('TestRelation'));
$t->is($column->isForeignKey(), true);
$t->is($column->getForeignClassName(), 'Test');
$t->is($column->getForeignTable()->getOption('name'), 'Test');
$t->is($column->getTable()->getOption('name'), 'TestRelation');
// Array access
$t->is($column['type'], 'integer');
 /**
  * Returns a sfValidator class name for a given column.
  *
  * @param sfDoctrineColumn $column
  * @return string    The name of a subclass of sfValidator
  */
 public function getValidatorClassForColumn($column)
 {
     switch ($column->getDoctrineType()) {
         case 'boolean':
             $validatorSubclass = 'Boolean';
             break;
         case 'string':
             if ($column->getDefinitionKey('email')) {
                 $validatorSubclass = 'Email';
             } elseif ($column->getDefinitionKey('regexp')) {
                 $validatorSubclass = 'Regex';
             } elseif ($column->getTable()->isLinkColumn($column->getName())) {
                 $validatorClass = 'dmValidatorLinkUrl';
             } else {
                 $validatorSubclass = 'String';
             }
             break;
         case 'clob':
         case 'blob':
             $validatorSubclass = 'String';
             break;
         case 'float':
         case 'decimal':
             $validatorSubclass = 'Number';
             break;
         case 'integer':
             $validatorSubclass = 'Integer';
             break;
         case 'date':
             $validatorClass = 'dmValidatorDate';
             break;
         case 'time':
             $validatorSubclass = 'Time';
             break;
         case 'timestamp':
             $validatorSubclass = 'DateTime';
             break;
         case 'enum':
             $validatorSubclass = 'Choice';
             break;
         default:
             $validatorSubclass = 'Pass';
     }
     if ($column->isPrimaryKey() || $column->isForeignKey()) {
         $validatorSubclass = 'DoctrineChoice';
     }
     $validatorClass = isset($validatorClass) ? $validatorClass : sprintf('sfValidator%s', $validatorSubclass);
     $validatorClass = $this->getGeneratorManager()->getConfiguration()->getEventDispatcher()->filter(new sfEvent($this, 'dm.form_generator.validator_class', array('column' => $column)), $validatorClass)->getReturnValue();
     return $validatorClass;
 }
 /**
  * Returns a sfValidator class name for a given column.
  *
  * @param sfDoctrineColumn $column
  * @return string    The name of a subclass of sfValidator
  */
 public function getValidatorClassForColumn($column)
 {
     switch ($column->getDoctrineType()) {
         case 'boolean':
             $validatorSubclass = 'Boolean';
             break;
         case 'string':
             if ($column->getDefinitionKey('email')) {
                 $validatorSubclass = 'Email';
             } else {
                 if ($column->getDefinitionKey('regexp')) {
                     $validatorSubclass = 'Regex';
                 } else {
                     $validatorSubclass = 'String';
                 }
             }
             break;
         case 'clob':
         case 'blob':
             $validatorSubclass = 'String';
             break;
         case 'float':
         case 'decimal':
             $validatorSubclass = 'Number';
             break;
         case 'integer':
             $validatorSubclass = 'Integer';
             break;
         case 'date':
             $validatorSubclass = 'Date';
             break;
         case 'time':
             $validatorSubclass = 'Time';
             break;
         case 'timestamp':
             $validatorSubclass = 'DateTime';
             break;
         case 'enum':
             $validatorSubclass = 'Choice';
             break;
         default:
             $validatorSubclass = 'Pass';
     }
     if ($column->isForeignKey()) {
         $validatorSubclass = 'DoctrineChoice';
     } else {
         if ($column->isPrimaryKey()) {
             $validatorSubclass = 'Choice';
         }
     }
     return sprintf('sfValidator%s', $validatorSubclass);
 }
 /**
  * Get validator class for column
  * 
  * @param   sfDoctrineColumn    $column
  * @return  string  Name of validator class
  */
 public function getValidatorClassForColumn($column)
 {
     $type = $column->getDoctrineType();
     $default = isset($this->validatorClasses[$type]) ? $this->validatorClasses[$type] : 'sfValidatorPass';
     if ($type == 'string') {
         if ($column->getDefinitionKey('email')) {
             $default = 'sfValidatorEmail';
         } else {
             if ($column->getDefinitionKey('regexp')) {
                 $default = 'sfValidatorRegex';
             }
         }
     }
     $name = $this->config->getFormValidatorClass($this->modelName, $column->getName(), $type, $default);
     if ($column->isForeignKey()) {
         $name = 'sfValidatorDoctrineChoice';
     } else {
         if ($column->isPrimaryKey()) {
             $name = 'sfValidatorChoice';
         }
     }
     return $name;
 }