2008-05-08 18:17:35 +04:00
|
|
|
<?php
|
2008-07-21 00:13:24 +04:00
|
|
|
|
|
|
|
#namespace Doctrine::Tests::ORM::Models::CMS;
|
|
|
|
|
|
|
|
#use Doctrine::ORM::Entity;
|
|
|
|
|
2008-12-18 17:08:11 +03:00
|
|
|
class CmsComment
|
2008-05-08 18:17:35 +04:00
|
|
|
{
|
2008-12-18 17:08:11 +03:00
|
|
|
public $id;
|
|
|
|
public $topic;
|
|
|
|
public $text;
|
|
|
|
public $article;
|
|
|
|
|
|
|
|
/*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__, 'article_id', 'int');
|
|
|
|
Doctrine_Common_VirtualPropertySystem::register(__CLASS__, 'article', 'CmsArticle');
|
|
|
|
}*/
|
2008-07-21 00:13:24 +04:00
|
|
|
|
|
|
|
public static function initMetadata($mapping)
|
|
|
|
{
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'id',
|
|
|
|
'type' => 'integer',
|
|
|
|
'id' => true,
|
|
|
|
'generatorType' => 'auto'
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'topic',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => 255
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'text',
|
|
|
|
'type' => 'string'
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'article_id',
|
2008-12-18 17:08:11 +03:00
|
|
|
'type' => 'integer'
|
2008-07-21 00:13:24 +04:00
|
|
|
));
|
2008-08-22 13:37:03 +04:00
|
|
|
|
|
|
|
$mapping->mapManyToOne(array(
|
|
|
|
'fieldName' => 'article',
|
|
|
|
'targetEntity' => 'CmsArticle',
|
|
|
|
'joinColumns' => array('article_id' => 'id')
|
|
|
|
));
|
2008-07-21 00:13:24 +04:00
|
|
|
}
|
2008-05-08 18:17:35 +04:00
|
|
|
}
|