2 namespace Utility\Entity;
4 use Doctrine\ORM\Mapping as ORM;
11 * @ORM\HasLifecycleCallbacks
12 * @ORM\Table(name="lib_document")
18 * Can archive records.
22 * Pull Synchronization Strategy for this table.
24 const PULL_SYNCH_STRATEGY = false;
26 * Push Synchronization Strategy for this table.
28 const PUSH_SYNCH_STRATEGY = false;
32 * @ORM\Column(type="integer");
33 * @ORM\GeneratedValue(strategy="AUTO")
38 * @ORM\Column(type="string", length=250)
43 * @ORM\Column(type="string", length=200, name="mime_type")
48 * @ORM\Column(type="integer")
50 protected $downloads = 0;
53 * @ORM\Column(type="datetime");
58 * @ORM\Column(type="boolean");
60 protected $archived = false;
64 * Magic getter to expose protected properties.
65 * @param string $property
68 public function __get($property)
70 return $this->$property;
74 * Magic setter to save protected properties.
75 * @param string $property
78 public function __set($property, $value)
80 $this->$property = $value;
86 public function setCreateTime()
88 $this->created = new \DateTime("now");
92 * Convert the object to an array.
93 * @param array $expand
96 public function toArray(array $expand = array())
100 'filename' => $this->filename,
101 'mimeType' => $this->mimeType,
102 'downloads' => $this->downloads,
103 'created' => !is_null($this->created)
104 ? $this->created->format(\Utility\Registry::getConfigParam('DateTimeFormat'))
110 * Populate from an array.
113 public function fromArray($data = array())
116 && $this->id = $data['id'];
117 isset($data['filename'])
118 && $this->filename = $data['filename'];
119 isset($data['mimeType'])
120 && $this->mimeType = $data['mimeType'];
121 isset($data['downloads'])
122 && $this->downloads = $data['downloads'];