Bouncy Melons 0.1
declarative style orm
TimeField.php
Go to the documentation of this file.
1 <?php
2 
3 namespace bm;
4 
5 class TimeField extends Field {
6  const DEFAULT_SQL_TYPE = "time";
7 
8  public function beforeSet($value, ISingle $single) {
9  return date('H:i:s',strtotime($value));
10  }
11 
12  public function beforeGet($value, ISingle $single) {
13  $val = parent::beforeGet($value, $single);
14  $format = $this->getOption('format');
15  if(empty($format)) {
16  $format = "H:i:s";
17  }
18  return date($format,strtotime($value));
19  }
20 }
beforeGet($value, ISingle $single)
Definition: TimeField.php:12
beforeSet($value, ISingle $single)
Definition: TimeField.php:8