Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($this->getMetaData()->columns as $column) {
- $columnName = $column->name;
- switch ($column->dbType) {
- case 'date':
- if (empty($this->$columnName)) {
- $this->setAttribute($columnName, null);
- } else {
- $this->setAttribute($columnName, date('d.m.Y', strtotime($this->$columnName)));
- }
- break;
- case 'timestamp without time zone':
- if (empty($this->$columnName)) {
- $this->setAttribute($columnName, null);
- } else {
- $this->setAttribute($columnName, date('d.m.Y H:i:s', strtotime($this->$columnName)));
- }
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement