2008-05-06 21:03:31 +00:00
|
|
|
<?php
|
2008-07-20 20:13:24 +00:00
|
|
|
|
2009-01-22 19:38:10 +00:00
|
|
|
namespace Doctrine\Tests\Models\CMS;
|
2008-07-20 20:13:24 +00:00
|
|
|
|
2009-01-05 17:25:56 +00:00
|
|
|
/**
|
2009-05-29 10:23:13 +00:00
|
|
|
* @Entity
|
|
|
|
* @Table(name="cms_articles")
|
2009-01-05 17:25:56 +00:00
|
|
|
*/
|
2008-12-18 14:08:11 +00:00
|
|
|
class CmsArticle
|
2008-05-06 21:03:31 +00:00
|
|
|
{
|
2009-01-05 17:25:56 +00:00
|
|
|
/**
|
2009-05-29 10:23:13 +00:00
|
|
|
* @Id
|
|
|
|
* @Column(type="integer")
|
2009-06-07 17:20:37 +00:00
|
|
|
* @GeneratedValue(strategy="AUTO")
|
2009-01-05 17:25:56 +00:00
|
|
|
*/
|
2008-12-18 14:08:11 +00:00
|
|
|
public $id;
|
2009-01-05 17:25:56 +00:00
|
|
|
/**
|
2009-05-29 10:23:13 +00:00
|
|
|
* @Column(type="string", length=255)
|
2009-01-05 17:25:56 +00:00
|
|
|
*/
|
2008-12-18 14:08:11 +00:00
|
|
|
public $topic;
|
2009-01-05 17:25:56 +00:00
|
|
|
/**
|
2009-12-06 23:40:38 +00:00
|
|
|
* @Column(type="text")
|
2009-01-05 17:25:56 +00:00
|
|
|
*/
|
2008-12-18 14:08:11 +00:00
|
|
|
public $text;
|
2009-01-05 17:25:56 +00:00
|
|
|
/**
|
2010-04-10 00:00:36 +02:00
|
|
|
* @ManyToOne(targetEntity="CmsUser", inversedBy="articles")
|
2009-05-29 10:23:13 +00:00
|
|
|
* @JoinColumn(name="user_id", referencedColumnName="id")
|
2009-01-05 17:25:56 +00:00
|
|
|
*/
|
2008-12-18 14:08:11 +00:00
|
|
|
public $user;
|
2009-01-05 17:25:56 +00:00
|
|
|
/**
|
2009-05-29 10:23:13 +00:00
|
|
|
* @OneToMany(targetEntity="CmsComment", mappedBy="article")
|
2009-01-05 17:25:56 +00:00
|
|
|
*/
|
2008-12-18 14:08:11 +00:00
|
|
|
public $comments;
|
2010-04-11 16:43:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @Version @column(type="integer")
|
|
|
|
*/
|
|
|
|
public $version;
|
2011-12-19 22:56:19 +01:00
|
|
|
|
2009-07-02 11:48:44 +00:00
|
|
|
public function setAuthor(CmsUser $author) {
|
|
|
|
$this->user = $author;
|
|
|
|
}
|
2010-07-08 00:20:54 +02:00
|
|
|
|
|
|
|
public function addComment(CmsComment $comment) {
|
|
|
|
$this->comments[] = $comment;
|
|
|
|
$comment->setArticle($this);
|
|
|
|
}
|
2008-05-06 21:03:31 +00:00
|
|
|
}
|