Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / Models / CMS / CmsArticle.php
1 <?php
2
3 namespace Doctrine\Tests\Models\CMS;
4
5 /**
6  * @Entity
7  * @Table(name="cms_articles")
8  */
9 class CmsArticle
10 {
11     /**
12      * @Id
13      * @Column(type="integer")
14      * @GeneratedValue(strategy="AUTO")
15      */
16     public $id;
17     /**
18      * @Column(type="string", length=255)
19      */
20     public $topic;
21     /**
22      * @Column(type="text")
23      */
24     public $text;
25     /**
26      * @ManyToOne(targetEntity="CmsUser", inversedBy="articles")
27      * @JoinColumn(name="user_id", referencedColumnName="id")
28      */
29     public $user;
30     /**
31      * @OneToMany(targetEntity="CmsComment", mappedBy="article")
32      */
33     public $comments;
34
35     /**
36      * @Version @column(type="integer")
37      */
38     public $version;
39
40     public function setAuthor(CmsUser $author) {
41         $this->user = $author;
42     }
43
44     public function addComment(CmsComment $comment) {
45         $this->comments[] = $comment;
46         $comment->setArticle($this);
47     }
48 }