| author | ymh <ymh.work@gmail.com> |
| Fri, 09 Dec 2011 06:43:49 +0100 | |
| changeset 62 | 10be6b9e55e7 |
| parent 58 | 87bf6ec8af90 |
| child 63 | 774ba82dca59 |
| permissions | -rwxr-xr-x |
| 2 | 1 |
<?php |
2 |
/* |
|
3 |
* This file is part of the WikiTagBundle package. |
|
4 |
* |
|
5 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
6 |
* |
|
7 |
* For the full copyright and license information, please view the LICENSE |
|
8 |
* file that was distributed with this source code. |
|
9 |
*/ |
|
10 |
||
11 |
namespace IRI\Bundle\WikiTagBundle\Model; |
|
12 |
||
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
13 |
use Doctrine\Common\Collections\ArrayCollection; |
| 27 | 14 |
use Doctrine\Common\Util\Debug; |
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
15 |
|
|
17
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
16 |
abstract class Document implements DocumentInterface { |
| 2 | 17 |
|
18 |
/** |
|
19 |
* @var integer $id |
|
20 |
*/ |
|
21 |
protected $id; |
|
22 |
||
23 |
/** |
|
24 |
* @var boolean $manualOrder |
|
25 |
*/ |
|
| 3 | 26 |
protected $manualOrder = false; |
27 |
||
28 |
/** |
|
29 |
* @var string $externalId |
|
30 |
*/ |
|
31 |
protected $externalId; |
|
| 2 | 32 |
|
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
33 |
/** |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
34 |
* @var ArrayCollection $tags |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
35 |
*/ |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
36 |
protected $tags; |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
37 |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
38 |
/** |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
39 |
* @var string tagsStr |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
40 |
*/ |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
41 |
protected $tagsStr; |
|
62
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
42 |
|
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
43 |
/** |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
44 |
* @var DateTime |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
45 |
*/ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
46 |
protected $createdAt; |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
47 |
|
| 2 | 48 |
|
49 |
/** |
|
50 |
* Get id |
|
51 |
* |
|
52 |
* @return integer |
|
53 |
*/ |
|
54 |
public function getId() |
|
55 |
{ |
|
56 |
return $this->id; |
|
57 |
} |
|
58 |
||
59 |
||
60 |
/** |
|
61 |
* Set manualOrder |
|
62 |
* |
|
63 |
* @param boolean $manualOrder |
|
64 |
*/ |
|
65 |
function setManualOrder($manualOrder) |
|
66 |
{ |
|
67 |
$this->manualOrder = $manualOrder; |
|
68 |
} |
|
69 |
||
70 |
/** |
|
71 |
* Get manualOrder |
|
72 |
* |
|
73 |
* @return boolean |
|
74 |
*/ |
|
75 |
function getManualOrder() |
|
76 |
{ |
|
77 |
return $this->manualOrder; |
|
78 |
} |
|
79 |
||
| 3 | 80 |
/** |
| 58 | 81 |
* (non-PHPdoc) |
| 3 | 82 |
* @see IRI\Bundle\WikiTagBundle\Model.BaseDocumentInterface::setExternalId() |
83 |
*/ |
|
84 |
function setExternalId($externalId) |
|
85 |
{ |
|
86 |
$this->externalId = $externalId; |
|
87 |
} |
|
88 |
||
89 |
/** |
|
| 58 | 90 |
* (non-PHPdoc) |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
91 |
* @see IRI\Bundle\WikiTagBundle\Model.DocumentInterface::getExternalId() |
| 3 | 92 |
*/ |
93 |
function getExternalId() |
|
94 |
{ |
|
95 |
return $this->externalId; |
|
96 |
} |
|
| 2 | 97 |
|
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
98 |
/** |
| 58 | 99 |
* (non-PHPdoc) |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
100 |
* @see IRI\Bundle\WikiTagBundle\Model.DocumentInterface::getTags() |
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
101 |
*/ |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
102 |
function getTags() |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
103 |
{ |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
104 |
return $this->tags; |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
105 |
} |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
3
diff
changeset
|
106 |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
107 |
/** |
| 58 | 108 |
* (non-PHPdoc) |
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
109 |
* @see IRI\Bundle\WikiTagBundle\Model.DocumentInterface::setTagsStr() |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
110 |
*/ |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
111 |
function setTagsStr($tagsStr) |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
112 |
{ |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
113 |
$this->tagsStr = $tagsStr; |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
114 |
} |
| 58 | 115 |
|
116 |
/** |
|
117 |
* (non-PHPdoc) |
|
118 |
* @see IRI\Bundle\WikiTagBundle\Model.DocumentInterface::getTagsStr() |
|
119 |
*/ |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
120 |
function getTagsStr() |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
121 |
{ |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
122 |
return $this->tagsStr; |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
123 |
} |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
124 |
|
|
62
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
125 |
/** |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
126 |
* (non-PHPdoc) |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
127 |
* @see IRI\Bundle\WikiTagBundle\Model.DocumentInterface::getCreatedAt() |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
128 |
*/ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
129 |
function getCreatedAt() |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
130 |
{ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
131 |
return $this->createdAt; |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
132 |
} |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
133 |
|
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
134 |
/** |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
135 |
* |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
136 |
* construct the class |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
137 |
*/ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
138 |
function __construct() |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
139 |
{ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
140 |
$this->createdAt = new \DateTime("now", new \DateTimeZone('UTC')); |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
141 |
} |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
142 |
|
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
143 |
|
| 27 | 144 |
public function __toString() |
145 |
{ |
|
146 |
return print_r(Debug::export($this, 3),true); |
|
147 |
} |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
20
diff
changeset
|
148 |
|
| 2 | 149 |
} |