forked from doctrine/mongodb-odm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFile.php
94 lines (77 loc) · 1.49 KB
/
File.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
<?php
declare(strict_types=1);
namespace Documents;
use DateTime;
use DateTimeInterface;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/** @ODM\File(chunkSizeBytes=12345) */
class File
{
/**
* @ODM\Id
*
* @var string|null
*/
private $id;
/**
* @ODM\File\Filename
*
* @var string|null
*/
private $filename;
/**
* @ODM\File\ChunkSize
*
* @var int|null
*/
private $chunkSize;
/**
* @ODM\File\Length
*
* @var int|null
*/
private $length;
/**
* @ODM\File\UploadDate
*
* @var DateTime|null
*/
private $uploadDate;
/**
* @ODM\File\Metadata(targetDocument=FileMetadata::class)
*
* @var FileMetadata|null
*/
private $metadata;
public function getId(): ?string
{
return $this->id;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function getChunkSize(): ?int
{
return $this->chunkSize;
}
public function getLength(): ?int
{
return $this->length;
}
public function getUploadDate(): ?DateTimeInterface
{
return $this->uploadDate;
}
public function getMetadata(): ?FileMetadata
{
return $this->metadata;
}
public function getOrCreateMetadata(): FileMetadata
{
if (! $this->metadata) {
$this->metadata = new FileMetadata();
}
return $this->metadata;
}
}