Bouncy Melons 0.1
declarative style orm
DateField.php
Go to the documentation of this file.
1 <?php
2 
3 namespace bm;
4 
16 class DateField extends Field {
17  const DEFAULT_SQL_TYPE = "date";
18 
19  public function beforeSet($value, ISingle $single) {
20  return date('Y-m-d',strtotime($value));
21  }
22 
23  public function beforeGet($value, ISingle $single) {
24  $val = parent::beforeGet($value, $single);
25  $format = $this->getOption('format');
26  if(empty($format)) {
27  $format = "Y-m-d";
28  }
29  return date($format,strtotime($value));
30  }
31 }
beforeSet($value, ISingle $single)
Definition: DateField.php:19
beforeGet($value, ISingle $single)
Definition: DateField.php:23