2008-05-07 01:03:31 +04:00
|
|
|
<?php
|
2008-07-21 00:13:24 +04:00
|
|
|
|
|
|
|
#namespace Doctrine::Tests::ORM::Models::CMS;
|
|
|
|
|
|
|
|
#use Doctrine::ORM::Entity;
|
|
|
|
|
2008-05-14 01:20:34 +04:00
|
|
|
class CmsArticle extends Doctrine_Entity
|
2008-05-07 01:03:31 +04:00
|
|
|
{
|
2008-07-21 00:13:24 +04:00
|
|
|
#protected $id;
|
|
|
|
#protected $topic;
|
|
|
|
#protected $text;
|
|
|
|
#protected $user_id;
|
|
|
|
|
|
|
|
public static function initMetadata($mapping)
|
|
|
|
{
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'id',
|
|
|
|
'type' => 'integer',
|
|
|
|
'length' => 4,
|
|
|
|
'id' => true,
|
2008-07-27 23:38:56 +04:00
|
|
|
'idGenerator' => 'auto'
|
2008-07-21 00:13:24 +04:00
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'topic',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => 255
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'text',
|
|
|
|
'type' => 'string'
|
|
|
|
));
|
|
|
|
$mapping->mapField(array(
|
|
|
|
'fieldName' => 'user_id',
|
|
|
|
'type' => 'integer',
|
|
|
|
'length' => 4
|
|
|
|
));
|
2008-08-16 23:40:59 +04:00
|
|
|
|
|
|
|
/*$mapping->hasMany('CmsComment as comments', array(
|
|
|
|
'local' => 'id', 'foreign' => 'article_id'));*/
|
|
|
|
|
|
|
|
$mapping->mapOneToMany(array(
|
|
|
|
'fieldName' => 'comments',
|
|
|
|
'targetEntity' => 'CmsComment',
|
|
|
|
));
|
|
|
|
|
|
|
|
/*$mapping->mapManyToOne(array(
|
|
|
|
'fieldName' => 'author',
|
|
|
|
'joinColumns' => array('user_id' => 'id')
|
|
|
|
));*/
|
2008-07-21 00:13:24 +04:00
|
|
|
}
|
2008-05-07 01:03:31 +04:00
|
|
|
}
|