CmsArticle::addComment()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Doctrine\Tests\Models\CMS;
4
5
/**
6
 * @Document
7
 */
8
class CmsArticle
9
{
10
    /** @Id */
11
    public $id;
12
    /** @Field(type="string") */
13
    public $topic;
14
    /** @Field(type="string") */
15
    public $text;
16
    /** @ReferenceOne(targetDocument="CmsUser") */
17
    public $user;
18
    public $comments;
19
    /** @Version */
20
    public $version;
21
22
    /** @Attachments */
23
    public $attachments;
24
    
25
    public function setAuthor(CmsUser $author) {
26
        $this->user = $author;
27
    }
28
29
    public function addComment(CmsComment $comment) {
30
        $this->comments[] = $comment;
31
        $comment->setArticle($this);
32
    }
33
}
34