commit 3e96fe94fdaf2392d110a2c6057412981f95e212
parent ef39e8234f74dc513ae556cca266b8868da5dde0
Author: Felicitus <felicitus@felicitus.org>
Date: Mon, 6 Jul 2015 03:49:49 +0200
Removed serializer/deserializer legacy code
Diffstat:
1 file changed, 65 insertions(+), 90 deletions(-)
diff --git a/src/PartKeepr/FootprintBundle/Entity/FootprintAttachment.php b/src/PartKeepr/FootprintBundle/Entity/FootprintAttachment.php
@@ -1,103 +1,78 @@
<?php
namespace PartKeepr\FootprintBundle\Entity;
-use PartKeepr\Util\Deserializable,
- PartKeepr\Util\Serializable,
- PartKeepr\UploadedFile\UploadedFile,
- Doctrine\ORM\Mapping as ORM;
+use Doctrine\ORM\Mapping as ORM;
+use PartKeepr\UploadedFileBundle\Entity\UploadedFile;
/**
* Holds a footprint attachment
+ *
* @ORM\Entity
**/
-class FootprintAttachment extends UploadedFile implements Serializable, Deserializable {
- /**
- * The description of this attachment
- * @ORM\Column(type="text")
- * @var string
- */
- private $description;
-
- /**
- * Creates a new footprint attachment
- */
- public function __construct () {
- parent::__construct();
- $this->setType("FootprintAttachment");
- }
- /**
- * The footprint object
- * @ORM\ManyToOne(targetEntity="PartKeepr\FootprintBundle\Entity\Footprint",inversedBy="attachments")
- *
- * @var Footprint
- */
- private $footprint = null;
+class FootprintAttachment extends UploadedFile
+{
+ /**
+ * The description of this attachment
+ * @ORM\Column(type="text")
+ *
+ * @var string
+ */
+ private $description;
- /**
- * Sets the footprint
- * @param Footprint $footprint The footprint to set
- */
- public function setFootprint (Footprint $footprint) {
- $this->footprint = $footprint;
- }
+ /**
+ * Creates a new footprint attachment
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setType("FootprintAttachment");
+ }
- /**
- * Returns the footprint
- * @return Footprint the footprint
- */
- public function getFootprint () {
- return $this->footprint;
- }
-
- /**
- * 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;
- }
+ /**
+ * The footprint object
+ * @ORM\ManyToOne(targetEntity="PartKeepr\FootprintBundle\Entity\Footprint",inversedBy="attachments")
+ *
+ * @var Footprint
+ */
+ private $footprint = null;
- /**
- *
- * Serializes this footprint attachment
- * @return array The serialized footprint attachment
- */
- public function serialize () {
- return array(
- "id" => $this->getId(),
- "footprint_id" => $this->getFootprint()->getId(),
- "originalFilename" => $this->getOriginalFilename(),
- "mimetype" => $this->getMimetype(),
- "extension" => $this->getExtension(),
- "size" => $this->getSize(),
- "description" => $this->getDescription());
- }
-
- /**
- * Deserializes the footprint attachment
- * @param array $parameters The array with the parameters to set
- */
- public function deserialize (array $parameters) {
- if (array_key_exists("id", $parameters)) {
- if (substr($parameters["id"], 0, 4) === "TMP:") {
- $this->replaceFromTemporaryFile($parameters["id"]);
- }
- }
+ /**
+ * Sets the footprint
+ *
+ * @param Footprint $footprint The footprint to set
+ */
+ public function setFootprint(Footprint $footprint)
+ {
+ $this->footprint = $footprint;
+ }
- foreach ($parameters as $key => $value) {
- switch ($key) {
- case "description":
- $this->setDescription($value);
- break;
- }
- }
- }
+ /**
+ * Returns the footprint
+ *
+ * @return Footprint the footprint
+ */
+ public function getFootprint()
+ {
+ return $this->footprint;
+ }
+
+ /**
+ * 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;
+ }
}
\ No newline at end of file