4 use Doctrine\ORM\Mapping as ORM;
11 * @ORM\HasLifecycleCallbacks
12 * @ORM\Table(name="lib_authentication_log")
14 class AuthenticationLog
18 * Can archive records.
20 const ARCHIVE = false;
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\ManyToOne(targetEntity="Profile", inversedBy="logins")
39 * @ORM\JoinColumn(nullable=true, name="profile_id", referencedColumnName="id")
44 * @ORM\Column(type="string", nullable=true, length=100, name="ip_address")
49 * @ORM\Column(type="datetime");
55 * Magic getter to expose protected properties.
56 * @param string $property
59 public function __get($property)
61 return $this->$property;
65 * Magic setter to save protected properties.
66 * @param string $property
69 public function __set($property, $value)
71 $this->$property = $value;
77 public function setCreateTime()
79 $this->created = new \DateTime("now");
83 * Convert the object to an array.
84 * @param array $expand
85 * @param array $intersect
88 public function toArray(array $expand = array('attachment'), array $intersect = array())
90 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
91 $includeAll = empty($intersect);
93 ($includeAll || isset($intersect['id']))
94 && $data['id'] = $this->id;
95 ($includeAll || isset($intersect['profile']))
96 && $data['profile'] = in_array('profile', $expand)
97 && !is_null($this->profile)
98 ? $this->profile->toArray($expand, $intersect)
100 ($includeAll || isset($intersect['ipAddress']))
101 && $data['ipAddress'] = $this->ipAddress;
102 ($includeAll || isset($intersect['created']))
103 && $data['created'] = !is_null($this->created)
104 ? $this->created->format($dateTimeFormat)
110 * Populate from an array.
113 public function fromArray($data = array())
116 && $this->id = $data['id'];
117 isset($data['profile'])
118 && $this->profile = $data['profile'];
119 isset($data['ipAddress'])
120 && $this->ipAddress = $data['ipAddress'];