From a4b238e1c4ec30e729a47776c4230755f387f496 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Fri, 8 Mar 2024 02:19:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20pr?= =?UTF-8?q?epareTable=20=D0=B8=20getTable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Model/AccessTokenModel.php | 17 +++++++++++++++++ .../src/Model/RefreshTokenModel.php | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/com_oauthserver/administrator/src/Model/AccessTokenModel.php b/com_oauthserver/administrator/src/Model/AccessTokenModel.php index bbe877f..c263682 100644 --- a/com_oauthserver/administrator/src/Model/AccessTokenModel.php +++ b/com_oauthserver/administrator/src/Model/AccessTokenModel.php @@ -43,4 +43,21 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface return $data; } + + /** + * @param \Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable $table + * @return void + * @since version + */ + protected function prepareTable($table) + { + if ($table->expiry instanceof \DateTime || $table->expiry instanceof \DateTimeImmutable) { + $table->expiry = $table->expiry->format($table->getDbo()->getDateFormat()); + } + } + + public function getTable($name = 'AccessToken', $prefix = 'Administrator', $options = []) + { + return parent::getTable($name, $prefix, $options); + } } \ No newline at end of file diff --git a/com_oauthserver/administrator/src/Model/RefreshTokenModel.php b/com_oauthserver/administrator/src/Model/RefreshTokenModel.php index ae66ae7..9d5fca8 100644 --- a/com_oauthserver/administrator/src/Model/RefreshTokenModel.php +++ b/com_oauthserver/administrator/src/Model/RefreshTokenModel.php @@ -35,4 +35,21 @@ class RefreshTokenModel extends AdminModel implements RevokedModelInterface return $data; } + + /** + * @param \Webmasterskaya\Component\OauthServer\Administrator\Table\RefreshTokenTable $table + * @return void + * @since version + */ + protected function prepareTable($table) + { + if ($table->expiry instanceof \DateTime || $table->expiry instanceof \DateTimeImmutable) { + $table->expiry = $table->expiry->format($table->getDbo()->getDateFormat()); + } + } + + public function getTable($name = 'RefreshToken', $prefix = 'Administrator', $options = []) + { + return parent::getTable($name, $prefix, $options); + } } \ No newline at end of file