1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/tests/models/cms/CmsArticle.php

59 lines
1.7 KiB
PHP
Raw Normal View History

2008-05-07 01:03:31 +04:00
<?php
#namespace Doctrine::Tests::ORM::Models::CMS;
#use Doctrine::ORM::Entity;
class CmsArticle
2008-05-07 01:03:31 +04:00
{
public $id;
public $topic;
public $text;
public $user;
public $comments;
/*static function construct() {
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'id', 'int');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'topic', 'string');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'text', 'string');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'user_id', 'int');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'user', 'CmsUser');
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'comments', 'collection');
}*/
public static function initMetadata($mapping)
{
$mapping->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'id' => true,
2008-07-27 23:38:56 +04:00
'idGenerator' => 'auto'
));
$mapping->mapField(array(
'fieldName' => 'topic',
'type' => 'string',
'length' => 255
));
$mapping->mapField(array(
'fieldName' => 'text',
'type' => 'string'
));
$mapping->mapField(array(
'fieldName' => 'user_id',
'type' => 'integer'
));
2008-08-16 23:40:59 +04:00
$mapping->mapOneToMany(array(
'fieldName' => 'comments',
'targetEntity' => 'CmsComment',
'mappedBy' => 'article'
2008-08-16 23:40:59 +04:00
));
$mapping->mapManyToOne(array(
'fieldName' => 'user',
'targetEntity' => 'CmsUser',
2008-08-16 23:40:59 +04:00
'joinColumns' => array('user_id' => 'id')
));
}
2008-05-07 01:03:31 +04:00
}