summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php
blob: 03af3d366c4375d238ad348b76e82ddbabfb9012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

class DateTimeTypeHandler extends TSqlMapTypeHandler
{
	/**
	 * Not implemented.
	 */
	public function getParameter($integer)
	{
		return date('Y-m-d H:i:s', $integer);
	}

	/**
	 * Not implemented.
	 */
	public function getResult($string)
	{
		if(intval($string) > 10000) //strtotime doesn't like unix epoc time.
			return intval($string);
		return strtotime($string);
	}

	/**
	 * Creates a new instance of TimeTrackerUser
	 * @param array result data
	 * @return TimeTrackerUser new user instance
	 */
	public function createNewInstance($row=null)
	{
		throw new TimeTrackerException('Not implemented');
	}

}

?>