|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of ONP. |
| 4 | + * |
| 5 | + * Copyright (c) Opensoft (http://opensoftdev.com) |
| 6 | + * |
| 7 | + * The unauthorized use of this code outside the boundaries of |
| 8 | + * Opensoft is prohibited. |
| 9 | + */ |
| 10 | + |
| 11 | +namespace Opensoft\StorageBundle\Entity; |
| 12 | + |
| 13 | +use Doctrine\ORM\Mapping as ORM; |
| 14 | + |
| 15 | +/** |
| 16 | + * @author Richard Fullmer <[email protected]> |
| 17 | + * |
| 18 | + * @ORM\Entity(repositoryClass="Opensoft\StorageBundle\Entity\Repository\StorageMoveExceptionRepository") |
| 19 | + * @ORM\Table(name="storage_move_exception") |
| 20 | + */ |
| 21 | +class StorageMoveException |
| 22 | +{ |
| 23 | + /** |
| 24 | + * @var int |
| 25 | + * |
| 26 | + * @ORM\Id |
| 27 | + * @ORM\Column(type="integer") |
| 28 | + * @ORM\GeneratedValue(strategy="AUTO") |
| 29 | + */ |
| 30 | + private $id; |
| 31 | + |
| 32 | + /** |
| 33 | + * @var StorageFile |
| 34 | + * |
| 35 | + * @ORM\ManyToOne(targetEntity="Opensoft\StorageBundle\Entity\StorageFile", inversedBy="moveExceptions") |
| 36 | + * @ORM\JoinColumn(name="storage_file_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
| 37 | + */ |
| 38 | + private $storageFile; |
| 39 | + |
| 40 | + /** |
| 41 | + * @var Storage |
| 42 | + * |
| 43 | + * @ORM\ManyToOne(targetEntity="Opensoft\StorageBundle\Entity\Storage") |
| 44 | + * @ORM\JoinColumn(name="from_storage_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
| 45 | + */ |
| 46 | + private $fromStorage; |
| 47 | + |
| 48 | + /** |
| 49 | + * @var Storage |
| 50 | + * |
| 51 | + * @ORM\ManyToOne(targetEntity="Opensoft\StorageBundle\Entity\Storage") |
| 52 | + * @ORM\JoinColumn(name="to_storage_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
| 53 | + */ |
| 54 | + private $toStorage; |
| 55 | + |
| 56 | + /** |
| 57 | + * @var \DateTime |
| 58 | + * |
| 59 | + * @ORM\Column(type="datetime", name="created_at") |
| 60 | + */ |
| 61 | + private $createdAt; |
| 62 | + |
| 63 | + /** |
| 64 | + * @var string |
| 65 | + * |
| 66 | + * @ORM\Column(type="string", name="exception_string") |
| 67 | + */ |
| 68 | + private $exceptionString; |
| 69 | + |
| 70 | + /** |
| 71 | + * @var string |
| 72 | + * |
| 73 | + * @ORM\Column(type="text", name="exception_backtrace") |
| 74 | + */ |
| 75 | + private $exceptionBacktrace; |
| 76 | + |
| 77 | + /** |
| 78 | + * @param StorageFile $file |
| 79 | + * @param Storage $fromStorage |
| 80 | + * @param Storage $toStorage |
| 81 | + * @param \Exception $e |
| 82 | + */ |
| 83 | + public function __construct(StorageFile $file, Storage $fromStorage, Storage $toStorage, \Exception $e) |
| 84 | + { |
| 85 | + $this->storageFile = $file; |
| 86 | + $this->fromStorage = $fromStorage; |
| 87 | + $this->toStorage = $toStorage; |
| 88 | + $this->createdAt = new \DateTime(); |
| 89 | + $this->exceptionString = $e->getMessage(); |
| 90 | + $this->exceptionBacktrace = $e->getTraceAsString(); |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * @return int |
| 95 | + */ |
| 96 | + public function getId() |
| 97 | + { |
| 98 | + return $this->id; |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * @return StorageFile |
| 103 | + */ |
| 104 | + public function getStorageFile() |
| 105 | + { |
| 106 | + return $this->storageFile; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * @return Storage |
| 111 | + */ |
| 112 | + public function getFromStorage() |
| 113 | + { |
| 114 | + return $this->fromStorage; |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * @return Storage |
| 119 | + */ |
| 120 | + public function getToStorage() |
| 121 | + { |
| 122 | + return $this->toStorage; |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * @return \DateTime |
| 127 | + */ |
| 128 | + public function getCreatedAt() |
| 129 | + { |
| 130 | + return $this->createdAt; |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * @return string |
| 135 | + */ |
| 136 | + public function getExceptionString() |
| 137 | + { |
| 138 | + return $this->exceptionString; |
| 139 | + } |
| 140 | + |
| 141 | + /** |
| 142 | + * @return string |
| 143 | + */ |
| 144 | + public function getExceptionBacktrace() |
| 145 | + { |
| 146 | + return $this->exceptionBacktrace; |
| 147 | + } |
| 148 | +} |
0 commit comments