2 namespace Utility\Entity;
4 use Doctrine\ORM\Mapping as ORM;
9 * A notification template.
11 * @ORM\Table(name="lib_template", uniqueConstraints={@ORM\UniqueConstraint(name="unique_template", columns={"name"})})
17 * Can archive records.
19 const ARCHIVE = false;
21 * Pull Synchronization Strategy for this table.
23 const PULL_SYNCH_STRATEGY = false;
25 * Push Synchronization Strategy for this table.
27 const PUSH_SYNCH_STRATEGY = false;
31 * @ORM\Column(type="integer");
32 * @ORM\GeneratedValue(strategy="AUTO")
37 * @ORM\Column(type="string", length=50, unique=true)
42 * @ORM\Column(type="string", length=100)
47 * @ORM\Column(type="text")
52 * @ORM\Column(type="text", name="email_template")
54 protected $emailTemplate;
57 * @ORM\Column(type="text", name="sms_template")
59 protected $smsTemplate;
62 * @ORM\OneToOne(targetEntity="RepeaterTemplate")
63 * @ORM\JoinColumn(name="lib_repeater_template_id")
65 protected $repeaterTemplate;
69 * Magic getter to expose protected properties.
70 * @param string $property
73 public function __get($property)
75 return $this->$property;
79 * Magic setter to save protected properties.
80 * @param string $property
83 public function __set($property, $value)
85 $this->$property = $value;
89 * Convert the object to an array.
90 * @param array $expand
93 public function toArray(array $expand = array('repeaterTemplate'))
97 'name' => $this->name,
98 'subject' => $this->subject,
99 'tags' => $this->tags,
100 'emailTemplate' => $this->emailTemplate,
101 'smsTemplate' => $this->smsTemplate,
102 'repeaterTemplate' => in_array('repeaterTemplate', $expand)
103 && !is_null($this->repeaterTemplate)
104 ? $this->repeaterTemplate->toArray($expand)
110 * Populate from an array.
113 public function fromArray($data = array())
116 && $this->id = $data['id'];
118 && $this->name = $data['name'];
119 isset($data['subject'])
120 && $this->subject = $data['subject'];
122 && $this->tags = $data['tags'];
123 isset($data['emailTemplate'])
124 && $this->emailTemplate = $data['emailTemplate'];
125 isset($data['smsTemplate'])
126 && $this->smsTemplate = $data['smsTemplate'];
127 isset($data['repeaterTemplate'])
128 && $this->repeaterTemplate = $data['repeaterTemplate'];