Created
September 13, 2018 15:29
-
-
Save Modicrumb/9101c074a896c1cf5d4b62f46da1627b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Entity; | |
use Cake\I18n\Time; | |
use Cake\ORM\Entity; | |
/** | |
* Expense Entity. | |
* | |
* @property int $id | |
* @property int $expense_type_id | |
* @property \App\Model\Entity\ExpenseType $expense_type | |
* @property string $creator | |
* @property \Cake\I18n\Time $created | |
* @property \Cake\I18n\Time $modified | |
*/ | |
class Expense extends Entity | |
{ | |
/** | |
* Fields that can be mass assigned using newEntity() or patchEntity(). | |
* | |
* Note that when '*' is set to true, this allows all unspecified fields to | |
* be mass assigned. For security purposes, it is advised to set '*' to false | |
* (or remove it), and explicitly make individual fields accessible as needed. | |
* | |
* @var array | |
*/ | |
protected $_accessible = [ | |
'*' => true, | |
'id' => false, | |
]; | |
public function setExpenseDate($timezone) { | |
$expenseDate = (new Time($this->expense_date, $timezone))->setTimezone('UTC'); | |
$this->set('expense_date',$expenseDate); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment