$this->hasOne('Test', array('local' => 'test_id', 'foreign' => 'id')); } } $column = new sfDoctrineColumn('name', Doctrine::getTable('Test')); $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');