<?php
 namespace Entity; class OAuth2AuthCode extends \App\Entity\GeneralAbstract { protected $saveInsideTransaction = false; public $skipUserAccessOnOperations = true; protected function setTableName() { global $DBTOauth2AuthCodes; $this->tableName = $DBTOauth2AuthCodes; } protected function setAttribute($var, $value) { if ($this->operation != 'insert' and $this->operation != 'update') { throw new \Exception('You can use the `__set` magic method only with insert/update operation in `'.__CLASS__.'` class.'); } switch ($var) { case 'codeId': case 'clientId': case 'idUser': case 'scopes': case 'redirectUri': case 'expiresAt': case 'isRevoked': { $this->fields[$var] = $value; break; } default: { throw new \Exception("The field '$var' is not valid for the `".__CLASS__."` entity on {$this->operation} operation."); } } } protected function save_finalSaveData(Array $saveData) { if ($this->operation == 'insert') { $saveData['addTime'] = DATETIME; } return $saveData; } }