partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit fe584ba8058119f36df0b035c5a176753443e132
parent 4dda6fb5b103ad0544bc3c00d3214e2fa41f028e
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed,  4 Nov 2015 17:54:38 +0100

Added created field, fixes #456

Diffstat:
Msrc/PartKeepr/UploadedFileBundle/Entity/UploadedFile.php | 113++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 69 insertions(+), 44 deletions(-)

diff --git a/src/PartKeepr/UploadedFileBundle/Entity/UploadedFile.php b/src/PartKeepr/UploadedFileBundle/Entity/UploadedFile.php @@ -84,19 +84,34 @@ abstract class UploadedFile extends BaseEntity */ private $replacement = null; + /** + * @ORM\Column(type="date",nullable=false) + * @var \DateTime + */ + private $created; + public function __construct() { $this->filename = Uuid::uuid1()->toString(); + $this->setCreated(new \DateTime()); } /** - * Sets a replacement image - * - * @param $replacement + * Returns the created date + * @return mixed */ - public function setReplacement($replacement) + public function getCreated() { - $this->replacement = $replacement; + return $this->created; + } + + /** + * Sets the created date + * @param mixed $created + */ + public function setCreated($created) + { + $this->created = $created; } /** @@ -110,14 +125,13 @@ abstract class UploadedFile extends BaseEntity } /** - * Sets the type of the file. Once the type is set, - * it may not be changed later. + * Sets a replacement image * - * @param string $type The type of the file + * @param $replacement */ - protected function setType($type) + public function setReplacement($replacement) { - $this->type = $type; + $this->replacement = $replacement; } /** @@ -173,33 +187,48 @@ abstract class UploadedFile extends BaseEntity } /** - * Returns the plain filename without path and suffix. + * Sets the type of the file. Once the type is set, + * it may not be changed later. * - * @return string The plain filename without path and suffix + * @param string $type The type of the file */ - public function getFilename() + protected function setType($type) { - return $this->filename; + $this->type = $type; } /** - * Returns the mime type for this file + * Returns the description for this attachment * - * @return string The mimetype for this file, e.g. text/plain + * @return string The description */ - public function getMimeType() + public function getDescription() { - return $this->mimetype; + return $this->description; } /** - * Sets the mimetype for this file + * Sets the description for this attachment * - * @param string $mimeType The mimetype + * @param string $description The attachment description */ - public function setMimeType($mimeType) + public function setDescription($description) { - $this->mimetype = $mimeType; + $this->description = $description; + } + + public function getFullFilename () { + return $this->getFilename().".".$this->getExtension(); + } + + /** + * Returns the plain filename without path and suffix. + * + * @return string The plain filename without path and suffix + */ + public function getFilename() + { + return $this->filename; } /** @@ -228,26 +257,6 @@ abstract class UploadedFile extends BaseEntity } /** - * Sets the description for this attachment - * - * @param string $description The attachment description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * Returns the description for this attachment - * - * @return string The description - */ - public function getDescription() - { - return $this->description; - } - - /** * Returns the extension for the given mime type. * * This function simply extracts that information from the mime type; @@ -270,7 +279,23 @@ abstract class UploadedFile extends BaseEntity } } - public function getFullFilename () { - return $this->getFilename().".".$this->getExtension(); + /** + * Returns the mime type for this file + * + * @return string The mimetype for this file, e.g. text/plain + */ + public function getMimeType() + { + return $this->mimetype; + } + + /** + * Sets the mimetype for this file + * + * @param string $mimeType The mimetype + */ + public function setMimeType($mimeType) + { + $this->mimetype = $mimeType; } }