forked from doctrine/phpcr-odm
/
CmsArticle.php
64 lines (51 loc) · 1.16 KB
/
CmsArticle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Doctrine\Tests\Models\CMS;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
/**
* @PHPCRODM\Document
*/
class CmsArticle
{
/** @PHPCRODM\Id */
public $id;
/** @PHPCRODM\String */
public $topic;
/** @PHPCRODM\String */
public $text;
/** @PHPCRODM\ReferenceOne(targetDocument="CmsUser") */
public $user;
public $comments;
/** @PHPCRODM\ReferenceMany(targetDocument="CmsArticlePerson") */
public $persons;
/** @PHPCRODM\Binary(nullable=true) */
public $attachments;
function __construct()
{
$this->persons = new ArrayCollection();
}
public function setAuthor(CmsUser $author)
{
$this->user = $author;
}
/**
* @param CmsArticlePerson $person
*/
public function addPerson(CmsArticlePerson $person){
$this->persons->add($person);
}
/**
* @param mixed $persons
*/
public function setPersons($persons)
{
$this->persons = $persons;
}
/**
* @return mixed
*/
public function getPersons()
{
return $this->persons;
}
}