-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/php 81 #178
base: master
Are you sure you want to change the base?
Feature/php 81 #178
Changes from all commits
665b09e
5791887
dc5d124
da3029f
2b0d43e
5012570
fe022c2
89b1e73
92949e1
17b5b17
ce19cc7
74fd201
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM cgsmith105/yii2-php:8.0-apache | ||
FROM yiisoftware/yii2-php:8.1-apache | ||
|
||
# Change document root for Apache | ||
RUN sed -i -e 's|/app/web|/app/api/web|g' /etc/apache2/sites-available/000-default.conf |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,11 +18,11 @@ | |||||||||
class Pagination extends Behavior | ||||||||||
{ | ||||||||||
|
||||||||||
const PAGE_NUMBER = 0; | ||||||||||
const PAGE_SIZE = 10; | ||||||||||
final const PAGE_NUMBER = 0; | ||||||||||
final const PAGE_SIZE = 10; | ||||||||||
|
||||||||||
CONST PAGE_SIZE_MIN = 0; | ||||||||||
const PAGE_SIZE_MAX = 1000; | ||||||||||
final CONST PAGE_SIZE_MIN = 0; | ||||||||||
final const PAGE_SIZE_MAX = 1000; | ||||||||||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
/** @var pagination */ | ||||||||||
public $pagination; | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,7 @@ public function actionIndex() | |
* @throws \yii\base\InvalidConfigException | ||
* @throws ForbiddenHttpException | ||
*/ | ||
public function actionCreate() | ||
public function actionCreate(): array|\api\modules\v1\models\customer\CustomerEx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Return type is wrong. |
||
{ | ||
// Check permissions | ||
if (!$this->apiConsumer->isSuperuser()) { | ||
|
@@ -238,7 +238,7 @@ public function actionCreate() | |
* @return array|\api\modules\v1\models\customer\CustomerEx | ||
* @throws ForbiddenHttpException | ||
*/ | ||
public function actionView($id) | ||
public function actionView($id): array|\api\modules\v1\models\customer\CustomerEx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Return type is wrong. |
||
{ | ||
// Check permissions | ||
if (!$this->apiConsumer->isSuperuser()) { | ||
|
@@ -325,7 +325,7 @@ public function actionView($id) | |
* @throws \yii\base\InvalidConfigException | ||
* @throws ForbiddenHttpException | ||
*/ | ||
public function actionUpdate($id) | ||
public function actionUpdate($id): array|\api\modules\v1\models\customer\CustomerEx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Return type is wrong. |
||
{ | ||
|
||
// Check permissions | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ public function actionIndex() | |
* @throws \yii\base\InvalidConfigException | ||
* @throws \yii\db\Exception | ||
*/ | ||
public function actionCreate() | ||
public function actionCreate(): array|\api\modules\v1\models\order\OrderEx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Return type is wrong. Same in similar cases. |
||
{ | ||
// Build the Order Form with the attributes sent in request | ||
$orderForm = new OrderForm(); | ||
|
@@ -267,7 +267,7 @@ public function actionCreate() | |
* | ||
* @return array|\api\modules\v1\models\order\OrderEx | ||
*/ | ||
public function actionView($id) | ||
public function actionView($id): array|\api\modules\v1\models\order\OrderEx | ||
{ | ||
if (($order = OrderEx::find() | ||
->byId($id) | ||
|
@@ -353,7 +353,7 @@ public function actionView($id) | |
* @throws \yii\base\InvalidConfigException | ||
* @throws \yii\db\Exception | ||
*/ | ||
public function actionUpdate($id) | ||
public function actionUpdate($id): array|\api\modules\v1\models\order\OrderEx | ||
{ | ||
// Build the Order Form with the attributes sent in request | ||
$orderForm = new OrderForm(); | ||
|
@@ -455,11 +455,7 @@ public function actionDelete($id) | |
|
||
$transaction->commit(); | ||
|
||
} catch (\Exception $e) { | ||
$transaction->rollBack(); | ||
|
||
return $this->errorMessage(400, 'Could not delete order'); | ||
} catch (\Throwable $e) { | ||
} catch (\Exception|\Throwable $e) { | ||
$transaction->rollBack(); | ||
|
||
return $this->errorMessage(400, 'Could not delete order'); | ||
|
@@ -515,15 +511,14 @@ public function actionDelete($id) | |
* }} | ||
* ) | ||
*/ | ||
|
||
/** | ||
* Get items of a specific order | ||
* | ||
* @param int $id Order ID | ||
* | ||
* @return array|\api\modules\v1\models\order\ItemEx | ||
*/ | ||
public function actionItems($id) | ||
public function actionItems($id): array|\api\modules\v1\models\order\ItemEx | ||
{ | ||
if (($order = OrderEx::find() | ||
->byId($id) | ||
|
@@ -543,7 +538,7 @@ public function actionItems($id) | |
* | ||
* @return array|\api\modules\v1\models\order\PackageEx | ||
*/ | ||
public function actionPackages($id) | ||
public function actionPackages($id): array|\api\modules\v1\models\order\PackageEx | ||
{ | ||
if (($order = OrderEx::find() | ||
->byId($id) | ||
|
@@ -902,7 +897,6 @@ public function actionStatus(int $id) | |
* }} | ||
* ) | ||
*/ | ||
|
||
/** | ||
* Find order by criteria | ||
* | ||
|
@@ -911,7 +905,7 @@ public function actionStatus(int $id) | |
* | ||
* @return array|\api\modules\v1\models\order\OrderEx | ||
*/ | ||
public function actionFind() | ||
public function actionFind(): array|\api\modules\v1\models\order\OrderEx | ||
{ | ||
$customerReference = $this->request->get('customer-reference', null); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ | |
class ApiConsumerEx extends ApiConsumer implements IdentityInterface | ||
{ | ||
|
||
const DATETIME_FORMAT = 'Y-m-d H:i:s'; | ||
const EXPIRE_TOKEN_AFTER = 15; // Time in minutes after which the auth token will expire | ||
final const DATETIME_FORMAT = 'Y-m-d H:i:s'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to add visibility modifier here and in similar case such as |
||
final const EXPIRE_TOKEN_AFTER = 15; // Time in minutes after which the auth token will expire | ||
|
||
/** @inheritdoc */ | ||
public static function findIdentity($id) | ||
|
@@ -99,7 +99,7 @@ public function isSuperuser() | |
* @return string|\DateTime | ||
* @throws \Exception | ||
*/ | ||
public function getTokenExpiration($formatted = true) | ||
public function getTokenExpiration($formatted = true): string|\DateTime | ||
{ | ||
$lastActivity = new \DateTime($this->last_activity, new \DateTimeZone("UTC")); | ||
$expiresOn = $lastActivity->add( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But please ensure that it's not used externally.