Failed Conditions
Pull Request — 2.6 (#7886)
by
unknown
13:51
created

CmsArticle::setAuthor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Doctrine\Tests\Models\CMSCustomId;
4
5
/**
6
 * @Entity
7
 * @Table(name="cms_articles_customid")
8
 */
9
class CmsArticle
10
{
11
    /**
12
     * @Id
13
     * @Column(type="CustomIdObject")
14
     * @GeneratedValue(strategy="NONE")
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
}
49