1
0
mirror of synced 2024-12-14 23:26:04 +03:00
doctrine2/tests/models/forum/ForumUser.php
2008-12-18 14:08:11 +00:00

46 lines
1.2 KiB
PHP

<?php
#namespace Doctrine\Tests\ORM\Models\Forum;
#use Doctrine\ORM\Entity;
#use Doctrine\Common\VirtualPropertySystem;
class ForumUser
{
public $id;
public $username;
public $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'));
// column-to-field mapping
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'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'),
'cascade' => array('save')
));
}
}