1
0
mirror of synced 2025-01-07 09:37:11 +03:00
doctrine2/tests/models/forum/ForumUser.php
2008-07-27 19:38:56 +00:00

47 lines
1.2 KiB
PHP

<?php
#namespace Doctrine::Tests::ORM::Models::Forum;
#use Doctrine::ORM::Entity;
class ForumUser extends Doctrine_Entity
{
#protected $dtype;
#protected $id;
#protected $username;
public static function initMetadata($mapping)
{
// inheritance mapping
$mapping->setInheritanceType('joined', array(
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(
'user' => 'ForumUser',
'admin' => 'ForumAdministrator')
));
// register subclasses
$mapping->setSubclasses(array('ForumAdministrator'));
// the discriminator column
$mapping->mapField(array(
'fieldName' => 'dtype',
'type' => 'string',
'length' => 50
));
// column-to-field mapping
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'length' => 4,
'id' => true,
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'username',
'type' => 'string',
'length' => 50
));
}
}