1
0
mirror of synced 2024-12-14 15:16:04 +03:00
doctrine2/tests/models/forum/ForumUser.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2008-02-11 20:08:22 +03:00
<?php
#namespace Doctrine\Tests\ORM\Models\Forum;
#use Doctrine\ORM\Entity;
#use Doctrine\Common\VirtualPropertySystem;
class ForumUser
2008-02-11 20:08:22 +03:00
{
public $id;
public $username;
public $avatar;
public static function initMetadata($mapping)
2008-02-11 20:08:22 +03:00
{
// inheritance mapping
$mapping->setInheritanceType('joined', array(
2008-02-11 20:08:22 +03:00
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(
'user' => 'ForumUser',
'admin' => 'ForumAdministrator')
2008-02-11 20:08:22 +03:00
));
2008-03-23 14:30:29 +03:00
// register subclasses
$mapping->setSubclasses(array('ForumAdministrator'));
2008-03-23 14:30:29 +03:00
// column-to-field mapping
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'id' => true,
2008-07-27 23:38:56 +04:00
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'username',
'type' => 'string',
'length' => 50
));
2008-08-16 23:40:59 +04:00
$mapping->mapOneToOne(array(
'fieldName' => 'avatar',
'targetEntity' => 'ForumAvatar',
'joinColumns' => array('avatar_id' => 'id'),
'cascade' => array('save')
));
2008-02-11 20:08:22 +03:00
}
}