1
0
mirror of synced 2025-01-06 00:57:10 +03:00
doctrine2/tests/models/forum/ForumUser.php
2008-08-16 19:40:59 +00:00

53 lines
1.4 KiB
PHP

<?php
#namespace Doctrine::Tests::ORM::Models::Forum;
#use Doctrine::ORM::Entity;
class ForumUser extends Doctrine_Entity
{
#protected $id;
#protected $username;
#protected $avatar;
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
));
$mapping->mapOneToOne(array(
'fieldName' => 'avatar',
'targetEntity' => 'ForumAvatar',
'joinColumns' => array('avatar_id' => 'id'),
));
}
}