1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/tests/Doctrine/Tests/Models/CMS/CmsArticle.php

49 lines
934 B
PHP
Raw Normal View History

2008-05-07 01:03:31 +04:00
<?php
namespace Doctrine\Tests\Models\CMS;
/**
* @Entity
* @Table(name="cms_articles")
*/
class CmsArticle
2008-05-07 01:03:31 +04:00
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @Column(type="string", length=255)
*/
public $topic;
/**
* @Column(type="text")
*/
public $text;
/**
2010-04-10 02:00:36 +04:00
* @ManyToOne(targetEntity="CmsUser", inversedBy="articles")
* @JoinColumn(name="user_id", referencedColumnName="id")
*/
public $user;
/**
* @OneToMany(targetEntity="CmsComment", mappedBy="article")
*/
public $comments;
/**
* @Version @column(type="integer")
*/
public $version;
2011-12-20 01:56:19 +04:00
public function setAuthor(CmsUser $author) {
$this->user = $author;
}
public function addComment(CmsComment $comment) {
$this->comments[] = $comment;
$comment->setArticle($this);
}
2008-05-07 01:03:31 +04:00
}