forked from pimcore/pimcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Document.php
1214 lines (1027 loc) · 33.5 KB
/
Document.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Pimcore
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @category Pimcore
* @package Document
* @copyright Copyright (c) 2009-2016 pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GNU General Public License version 3 (GPLv3)
*
*/
namespace Pimcore\Model;
use Pimcore\Tool;
use Pimcore\Tool\Frontend as FrontendTool;
class Document extends Element\AbstractElement {
/**
* possible types of a document
* @var array
*/
public static $types = array("folder", "page", "snippet", "link", "hardlink", "email"); //ck added "email"
/**
* @param $type
*/
public static function addDocumentType($type) {
if(!in_array($type, self::$types)) {
self::$types[] = $type;
}
}
/**
* @var bool
*/
private static $hidePublished = false;
/**
* @param $hidePublished
*/
public static function setHideUnpublished($hidePublished) {
self::$hidePublished = $hidePublished;
}
/**
* @return bool
*/
public static function doHideUnpublished() {
return self::$hidePublished;
}
/**
* ID of the document
*
* @var integer
*/
public $id;
/**
* ID of the parent document, on root document this is null
*
* @var integer
*/
public $parentId;
/**
* @var Document
*/
public $parent;
/**
* Type of the document as string (enum)
* Possible values: page,snippet,link,folder
*
* @var string
*/
public $type;
/**
* Filename/Key of the document
*
* @var string
*/
public $key;
/**
* Path to the document, not conaining the key (the full path of the parent document)
*
* @var string
*/
public $path;
/**
* Sorter index in the tree, can also be used for generating a navigation and so on
*
* @var integer
*/
public $index;
/**
* published or not
*
* @var bool
*/
public $published = true;
/**
* timestamp of creationdate
*
* @var integer
*/
public $creationDate;
/**
* timestamp of modificationdate
*
* @var integer
*/
public $modificationDate;
/**
* User-ID of the owner
*
* @var integer
*/
public $userOwner;
/**
* User-ID of the user last modified the document
*
* @var integer
*/
public $userModification;
/**
* Permissions for the user which requested this document in editmode*
*/
public $userPermissions;
/**
* Dependencies for this document
*
* @var Dependency
*/
public $dependencies;
/**
* List of Property, concerning the folder
*
* @var array
*/
public $properties = null;
/**
* Contains a list of child-documents
*
* @var array
*/
public $childs;
/**
* Indicator of document has childs or not.
*
* @var boolean
*/
public $hasChilds;
/**
* Contains a list of sibling documents
*
* @var array
*/
public $siblings;
/**
* Indicator if document has siblings or not
*
* @var boolean
*/
public $hasSiblings;
/**
* @var string
*/
public $locked = null;
/**
* get possible types
* @return string
*/
public static function getTypes() {
return self::$types;
}
/**
* Static helper to get a Document by it's path, only type Document is returned, not Document\Page, ... (see getConcreteByPath() )
*
* @param string $path
* @return Document
*/
public static function getByPath($path) {
$path = Element\Service::correctPath($path);
try {
$document = new Document();
// validate path
if (Tool::isValidPath($path)) {
$document->getDao()->getByPath($path);
}
return self::getById($document->getId());
}
catch (\Exception $e) {
\Logger::debug($e->getMessage());
}
return null;
}
/**
* Static helper to get a Document by it's id, only type Document is returned, not Document\Page, ... (see getConcreteById() )
*
* @param integer $id
* @return Document
*/
public static function getById($id) {
$id = intval($id);
if ($id < 1) {
return null;
}
$cacheKey = "document_" . $id;
try {
$document = \Zend_Registry::get($cacheKey);
if(!$document){
throw new \Exception("Document in registry is null");
}
}
catch (\Exception $e) {
try {
if (!$document = \Pimcore\Cache::load($cacheKey)) {
$document = new Document();
$document->getDao()->getById($id);
$mappingClass = "\\Pimcore\\Model\\Document\\" . ucfirst($document->getType());
// this is the fallback for custom document types using prefixes
// so we need to check if the class exists first
if(!Tool::classExists($mappingClass)) {
$oldStyleClass = "Document_" . ucfirst($document->getType());
if(Tool::classExists($oldStyleClass)) {
$mappingClass = $oldStyleClass;
}
}
$typeClass = Tool::getModelClassMapping($mappingClass);
if (Tool::classExists($typeClass)) {
$document = new $typeClass();
\Zend_Registry::set($cacheKey, $document);
$document->getDao()->getById($id);
\Pimcore\Cache::save($document, $cacheKey);
}
}
else {
\Zend_Registry::set($cacheKey, $document);
}
}
catch (\Exception $e) {
\Logger::warning($e->getMessage());
return null;
}
}
if(!$document) {
return null;
}
return $document;
}
/**
* Static helper to get a concrete implementation of a document by it's id, this method returns the concrete object to retrieve only the basic object use getById()
*
* @param Document|integer $id
* @return Document\Page|Document\Snippet|Document\Folder|Document\Link
*/
public static function getConcreteById($id) {
return self::getById($id);
}
/**
* Static helper to get a concrete implementation of a document by it's path, this method returns the concrete object to retrieve only the basic object use getById()
*
* @param string|Document $path
* @return Document\Page|Document\Snippet|Document\Folder|Document\Link
*/
public static function getConcreteByPath($path) {
return self::getByPath($path);
}
/**
* Static helper to quickly create a new document
*
* @param integer $parentId
* @param array $data
* @return Document
*/
public static function create($parentId, $data = array(), $save = true) {
$document = new static();
$document->setParentId($parentId);
foreach ($data as $key => $value) {
$document->setValue($key, $value);
}
if($save) {
$document->save();
}
return $document;
}
/**
* @param array $config
* @return mixed
* @throws \Exception
*/
public static function getList($config = array()) {
if (is_array($config)) {
$listClass = "\\Pimcore\\Model\\Document\\Listing";
$listClass = Tool::getModelClassMapping($listClass);
if (Tool::classExists($listClass)) {
$list = new $listClass();
$list->setValues($config);
$list->load();
return $list;
}
}
throw new \Exception("Unable to initiate list class - class not found or invalid configuration");
}
/**
* @param array $config
* @return total count
*/
public static function getTotalCount($config = array()) {
if (is_array($config)) {
$listClass = "\\Pimcore\\Model\\Document\\Listing";
$listClass = Tool::getModelClassMapping($listClass);
$list = new $listClass();
$list->setValues($config);
$count = $list->getTotalCount();
return $count;
}
}
/**
* @return $this
* @throws \Exception
*/
public function save() {
$isUpdate = false;
if ($this->getId()) {
$isUpdate = true;
\Pimcore::getEventManager()->trigger("document.preUpdate", $this);
} else {
\Pimcore::getEventManager()->trigger("document.preAdd", $this);
}
$this->correctPath();
// we wrap the save actions in a loop here, so that we can restart the database transactions in the case it fails
// if a transaction fails it gets restarted $maxRetries times, then the exception is thrown out
// this is especially useful to avoid problems with deadlocks in multi-threaded environments (forked workers, ...)
$maxRetries = 5;
for($retries=0; $retries<$maxRetries; $retries++) {
$this->beginTransaction();
try {
// check for a valid key, home has no key, so omit the check
if (!Tool::isValidKey($this->getKey()) && $this->getId() != 1) {
throw new \Exception("invalid key for document with id [ " . $this->getId() . " ] key is: [" . $this->getKey() . "]");
}
// set date
$this->setModificationDate(time());
if(!$this->getCreationDate()) {
$this->setCreationDate(time());
}
if (!$isUpdate) {
$this->getDao()->create();
}
// get the old path from the database before the update is done
$oldPath = null;
if ($isUpdate) {
$oldPath = $this->getDao()->getCurrentFullPath();
}
$this->update();
// if the old path is different from the new path, update all children
$updatedChildren = array();
if($oldPath && $oldPath != $this->getFullPath()) {
$this->getDao()->updateWorkspaces();
$updatedChildren = $this->getDao()->updateChildsPaths($oldPath);
}
$this->commit();
break; // transaction was successfully completed, so we cancel the loop here -> no restart required
} catch (\Exception $e) {
try {
$this->rollBack();
} catch (\Exception $er) {
// PDO adapter throws exceptions if rollback fails
\Logger::error($er);
}
// we try to start the transaction $maxRetries times again (deadlocks, ...)
if($retries < ($maxRetries-1)) {
$run = $retries+1;
$waitTime = 100000; // microseconds
\Logger::warn("Unable to finish transaction (" . $run . ". run) because of the following reason '" . $e->getMessage() . "'. --> Retrying in " . $waitTime . " microseconds ... (" . ($run+1) . " of " . $maxRetries . ")");
usleep($waitTime); // wait specified time until we restart the transaction
} else {
// if the transaction still fail after $maxRetries retries, we throw out the exception
throw $e;
}
}
}
$additionalTags = array();
if(isset($updatedChildren) && is_array($updatedChildren)) {
foreach ($updatedChildren as $documentId) {
$tag = "document_" . $documentId;
$additionalTags[] = $tag;
// remove the child also from registry (internal cache) to avoid path inconsistencies during long running scripts, such as CLI
\Zend_Registry::set($tag, null);
}
}
$this->clearDependentCache($additionalTags);
if ($isUpdate) {
\Pimcore::getEventManager()->trigger("document.postUpdate", $this);
} else {
\Pimcore::getEventManager()->trigger("document.postAdd", $this);
}
return $this;
}
/**
* @throws \Exception
*/
public function correctPath() {
// set path
if ($this->getId() != 1) { // not for the root node
if($this->getParentId() == $this->getId()) {
throw new \Exception("ParentID and ID is identical, an element can't be the parent of itself.");
}
$parent = Document::getById($this->getParentId());
if($parent) {
// use the parent's path from the database here (getCurrentFullPath), to ensure the path really exists and does not rely on the path
// that is currently in the parent object (in memory), because this might have changed but wasn't not saved
$this->setPath(str_replace("//", "/", $parent->getCurrentFullPath() . "/"));
} else {
// parent document doesn't exist anymore, set the parent to to root
$this->setParentId(1);
$this->setPath("/");
}
if (strlen($this->getKey()) < 1) {
throw new \Exception("Document requires key, generated key automatically");
}
} else if($this->getId() == 1) {
// some data in root node should always be the same
$this->setParentId(0);
$this->setPath("/");
$this->setKey("");
$this->setType("page");
}
if(Document\Service::pathExists($this->getRealFullPath())) {
$duplicate = Document::getByPath($this->getRealFullPath());
if ($duplicate instanceof Document and $duplicate->getId() != $this->getId()) {
throw new \Exception("Duplicate full path [ " . $this->getRealFullPath() . " ] - cannot save document");
}
}
if(strlen($this->getRealFullPath()) > 765) {
throw new \Exception("Full path is limited to 765 characters, reduce the length of your parent's path");
}
}
/**
* @throws \Exception
*/
protected function update() {
$disallowedKeysInFirstLevel = array("install","admin","webservice","plugin");
if($this->getParentId() == 1 && in_array($this->getKey(), $disallowedKeysInFirstLevel)) {
throw new \Exception("Key: " . $this->getKey() . " is not allowed in first level (root-level)");
}
// set index if null
if($this->getIndex() === null) {
$this->setIndex($this->getDao()->getNextIndex());
}
// save properties
$this->getProperties();
$this->getDao()->deleteAllProperties();
if (is_array($this->getProperties()) and count($this->getProperties()) > 0) {
foreach ($this->getProperties() as $property) {
if (!$property->getInherited()) {
$property->setDao(null);
$property->setCid($this->getId());
$property->setCtype("document");
$property->setCpath($this->getRealFullPath());
$property->save();
}
}
}
// save dependencies
$d = $this->getDependencies();
$d->clean();
foreach ($this->resolveDependencies() as $requirement) {
if ($requirement["id"] == $this->getId() && $requirement["type"] == "document") {
// dont't add a reference to yourself
continue;
}
else {
$d->addRequirement($requirement["id"], $requirement["type"]);
}
}
$d->save();
$this->getDao()->update();
//set object to registry
\Zend_Registry::set("document_" . $this->getId(), $this);
}
/**
* @param $index
*/
public function saveIndex($index) {
$this->getDao()->saveIndex($index);
$this->clearDependentCache();
}
/**
* @param array $additionalTags
*/
public function clearDependentCache($additionalTags = array()) {
try {
$tags = array("document_" . $this->getId(), "document_properties", "output");
$tags = array_merge($tags, $additionalTags);
\Pimcore\Cache::clearTags($tags);
}
catch (\Exception $e) {
\Logger::crit($e);
}
}
/**
* Returns the dependencies of the document
*
* @return Dependency
*/
public function getDependencies() {
if (!$this->dependencies) {
$this->dependencies = Dependency::getBySourceId($this->getId(), "document");
}
return $this->dependencies;
}
/**
* set the children of the document
*
* @return array
*/
public function setChilds($childs) {
$this->childs=$childs;
if(is_array($childs) and count($childs>0)){
$this->hasChilds=true;
} else if ($childs === null) {
$this->hasChilds = null;
} else {
$this->hasChilds=false;
}
return $this;
}
/**
* Get a list of the Childs (not recursivly)
* @param bool
* @return array
*/
public function getChilds($unpublished = false) {
if ($this->childs === null) {
$list = new Document\Listing();
$list->setUnpublished($unpublished);
$list->setCondition("parentId = ?", $this->getId());
$list->setOrderKey("index");
$list->setOrder("asc");
$this->childs = $list->load();
}
return $this->childs;
}
/**
* Returns true if the document has at least one child
*
* @return boolean
*/
public function hasChilds() {
if(is_bool($this->hasChilds)){
if(($this->hasChilds and empty($this->childs)) or (!$this->hasChilds and !empty($this->childs))){
return $this->getDao()->hasChilds();
} else {
return $this->hasChilds;
}
}
return $this->getDao()->hasChilds();
}
/**
* Get a list of the sibling documents
*
* @param bool $unpublished
* @return array
*/
public function getSiblings($unpublished = false) {
if ($this->siblings === null) {
$list = new Document\Listing();
$list->setUnpublished($unpublished);
// string conversion because parentId could be 0
$list->addConditionParam("parentId = ?", (string)$this->getParentId());
$list->addConditionParam("id != ?", $this->getId());
$list->setOrderKey("index");
$list->setOrder("asc");
$this->siblings = $list->load();
}
return $this->siblings;
}
/**
* Returns true if the document has at least one sibling
*
* @return bool
*/
public function hasSiblings() {
if(is_bool($this->hasSiblings)){
if(($this->hasSiblings and empty($this->siblings)) or (!$this->hasSiblings and !empty($this->siblings))){
return $this->getDao()->hasSiblings();
} else {
return $this->hasSiblings;
}
}
return $this->getDao()->hasSiblings();
}
/**
* Returns true if the element is locked
* @return string
*/
public function getLocked(){
if(empty($this->locked)) {
return null;
}
return $this->locked;
}
/**
* @param $locked
* @return void
*/
public function setLocked($locked){
$this->locked = $locked;
return $this;
}
/**
* Deletes the document
*
* @return void
*/
public function delete() {
\Pimcore::getEventManager()->trigger("document.preDelete", $this);
// remove childs
if ($this->hasChilds()) {
// delete also unpublished children
$unpublishedStatus = self::doHideUnpublished();
self::setHideUnpublished(false);
foreach ($this->getChilds(true) as $child) {
$child->delete();
}
self::setHideUnpublished($unpublishedStatus);
}
// remove all properties
$this->getDao()->deleteAllProperties();
// remove permissions
$this->getDao()->deleteAllPermissions();
// remove dependencies
$d = $this->getDependencies();
$d->cleanAllForElement($this);
$this->getDao()->delete();
// clear cache
$this->clearDependentCache();
//set object to registry
\Zend_Registry::set("document_" . $this->getId(), null);
\Pimcore::getEventManager()->trigger("document.postDelete", $this);
}
/**
* Returns the full path of the document including the key (path+key)
*
* @return string
*/
public function getFullPath() {
// check if this document is also the site root, if so return /
try {
if(Site::isSiteRequest()) {
$site = Site::getCurrentSite();
if ($site instanceof Site) {
if ($site->getRootDocument()->getId() == $this->getId()) {
return "/";
}
}
}
} catch (\Exception $e) {
\Logger::error($e);
}
// @TODO please forgive me, this is the dirtiest hack I've ever made :(
// if you got confused by this functionality drop me a line and I'll buy you some beers :)
// this is for the case that a link points to a document outside of the current site
// in this case we look for a hardlink in the current site which points to the current document
// why this could happen: we have 2 sites, in one site there's a hardlink to the other site and on a page inside
// the hardlink there are snippets embedded and this snippets have links pointing to a document which is also
// inside the hardlink scope, but this is an ID link, so we cannot rewrite the link the usual way because in the
// snippet / link we don't know anymore that whe a inside a hardlink wrapped document
if(!\Pimcore::inAdmin() && Site::isSiteRequest() && !FrontendTool::isDocumentInCurrentSite($this)) {
$documentService = new Document\Service();
$parent = $this;
while($parent) {
if($hardlinkId = $documentService->getDocumentIdFromHardlinkInSameSite(Site::getCurrentSite(), $parent)) {
$hardlink = Document::getById($hardlinkId);
if(FrontendTool::isDocumentInCurrentSite($hardlink)) {
$siteRootPath = Site::getCurrentSite()->getRootPath();
$siteRootPath = preg_quote($siteRootPath);
$hardlinkPath = preg_replace("@^" . $siteRootPath . "@", "", $hardlink->getRealFullPath());
return preg_replace("@^" . preg_quote($parent->getRealFullPath()) . "@", $hardlinkPath, $this->getRealFullPath());
break;
}
}
$parent = $parent->getParent();
}
$config = \Pimcore\Config::getSystemConfig();
$front = \Zend_Controller_Front::getInstance();
$scheme = ($front->getRequest()->isSecure() ? "https" : "http") . "://";
if($site = FrontendTool::getSiteForDocument($this)) {
if($site->getMainDomain()) {
// check if current document is the root of the different site, if so, preg_replace below doesn't work, so just return /
if ($site->getRootDocument()->getId() == $this->getId()) {
return $scheme . $site->getMainDomain() . "/";
}
return $scheme . $site->getMainDomain() . preg_replace("@^" . $site->getRootPath() . "/@", "/", $this->getRealFullPath());
}
}
if ($config->general->domain) {
return $scheme . $config->general->domain . $this->getRealFullPath();
}
}
$path = $this->getPath() . $this->getKey();
return $path;
}
/**
* @return integer
*/
public function getCreationDate() {
return $this->creationDate;
}
/**
* @return integer
*/
public function getId() {
return (int) $this->id;
}
/**
* @return string
*/
public function getKey() {
return $this->key;
}
/**
* @return integer
*/
public function getModificationDate() {
return $this->modificationDate;
}
/**
* @return integer
*/
public function getParentId() {
return $this->parentId;
}
/**
* @return string
*/
public function getPath() {
// check for site, if so rewrite the path for output
try {
if(!\Pimcore::inAdmin() && Site::isSiteRequest()) {
$site = Site::getCurrentSite();
if ($site instanceof Site) {
if ($site->getRootDocument() instanceof Document\Page && $site->getRootDocument() !== $this) {
$rootPath = $site->getRootPath();
$rootPath = preg_quote($rootPath);
return preg_replace("@^" . $rootPath . "@", "", $this->path);
}
}
}
} catch (\Exception $e) {
\Logger::error($e);
}
return $this->path;
}
/**
* @return string
*/
public function getRealPath() {
return $this->path;
}
/**
* @return string
*/
public function getRealFullPath() {
$path = $this->getRealPath() . $this->getKey();
return $path;
}
/**
* @param integer $creationDate
* @return void
*/
public function setCreationDate($creationDate) {
$this->creationDate = (int) $creationDate;
return $this;
}
/**
* @param integer $id
* @return void
*/
public function setId($id) {
$this->id = (int) $id;
return $this;
}
/**
* @param integer $key
* @return void
*/
public function setKey($key) {
$this->key = $key;
return $this;
}
/**
* @param integer $modificationDate
* @return void
*/
public function setModificationDate($modificationDate) {
$this->modificationDate = (int) $modificationDate;
return $this;
}
/**
* @param integer $parentId
* @return void
*/
public function setParentId($parentId) {
$this->parentId = (int) $parentId;
$this->parent = null;
return $this;
}
/**
* @param integer $path
* @return void
*/
public function setPath($path) {
$this->path = $path;
return $this;
}
/**
* @return integer
*/
public function getIndex() {
return $this->index;
}
/**
* @param integer $index
* @return void
*/
public function setIndex($index) {
$this->index = (int) $index;
return $this;
}
/**
* @return string
*/
public function getType() {
return $this->type;
}
/**
* @param integer $type
* @return void
*/
public function setType($type) {
$this->type = $type;
return $this;
}
/**
* @return integer
*/
public function getUserModification() {