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

53 lines
1.4 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;
class ForumUser extends Doctrine_Entity
2008-02-11 20:08:22 +03:00
{
#protected $id;
#protected $username;
2008-08-16 23:40:59 +04:00
#protected $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'));
// the discriminator column
$mapping->mapField(array(
'fieldName' => 'dtype',
'type' => 'string',
'length' => 50
));
2008-03-23 14:30:29 +03:00
// column-to-field mapping
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'length' => 4,
'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'),
));
2008-02-11 20:08:22 +03:00
}
2008-02-11 20:08:22 +03:00
}