diff --git a/docs/docs/05_Database/2_Doctrine Migrations.md b/docs/docs/05_Database/2_Doctrine Migrations.md index 7de37b39..66886a56 100644 --- a/docs/docs/05_Database/2_Doctrine Migrations.md +++ b/docs/docs/05_Database/2_Doctrine Migrations.md @@ -35,7 +35,7 @@ public function getDescription() : string } ``` -And throw the following exception the `down` method: +And throw the following exception in the `down` method: ```php public function down(Schema $schema) : void @@ -82,7 +82,7 @@ a new migration. :::note -📣  You should **only** do that if a remote environment like your production did not already apply the migration. +📣  **Do not** edit a migration if a remote environment like your production did apply the migration. ::: @@ -110,7 +110,7 @@ php bin/console doctrine:migrations:migrate -n :::note -📣  Reminder: you should **only** do that if a remote environment like your production did not already -apply the migration. +📣  Reminder: **Do not** edit a migration if a remote environment like your production did apply the migration. -::: \ No newline at end of file + +::: diff --git a/docs/docs/07_i18n/2_API.md b/docs/docs/07_i18n/2_API.md index 15732fb6..9aa7a865 100644 --- a/docs/docs/07_i18n/2_API.md +++ b/docs/docs/07_i18n/2_API.md @@ -152,7 +152,7 @@ Let's take a look at the `CreateXLSXExport` use case: public function create(string $locale, array $headerIds, array $values): Xlsx ``` -The method `create` takes, among other arguments, a locale. It will use it to translates the spreadsheet's headers +The method `create` takes, among other arguments, a locale. It will use it to translate the spreadsheet's headers accordingly. For values, you should translate them directly in your use cases before calling the `create` method. diff --git a/docs/docs/08_Security/2_Authentication.md b/docs/docs/08_Security/2_Authentication.md index 9596ae05..20f7db2d 100644 --- a/docs/docs/08_Security/2_Authentication.md +++ b/docs/docs/08_Security/2_Authentication.md @@ -73,7 +73,7 @@ We initialize these values with empty strings or `null` for the profile picture. **Getters:** *src/webapp/store/auth/getters.js* -* `isAuthenticated`: it returns `true` if the `user`'s `email` property from the state is empty. It might return `true` +* `isAuthenticated`: it returns `true` if the `user`'s `email` property from the state is not empty. It might return `true` even if the user has no more session in the API, but we will see below how to handle such a case. * `isGranted`: it returns `true` if the user has the authorization level of the given role. @@ -124,4 +124,4 @@ there is an `nuxtServerInit` method, which Nuxt.js calls before server-rendering In this function, we: 1. Set the header `Cookie` for every server-side GraphQL requests. -2. Call the `me` action to fetch (or not) the user data (useful when the user refreshes the page). \ No newline at end of file +2. Call the `me` action to fetch (or not) the user data (useful when the user refreshes the page). diff --git a/docs/docs/08_Security/3_Access Control.md b/docs/docs/08_Security/3_Access Control.md index 80922a04..e2379af7 100644 --- a/docs/docs/08_Security/3_Access Control.md +++ b/docs/docs/08_Security/3_Access Control.md @@ -221,7 +221,7 @@ It comes in two parts: #### GraphQL -For instance, let's examine the following scenario: an administrator can delete a user, but only not if he is that user: +For instance, let's examine the following scenario: an administrator can delete a user, but cannot delete himself: ```php title="src/api/src/UseCase/Product/UpdateProduct.php" use TheCodingMachine\GraphQLite\Annotations\Logged; @@ -354,4 +354,4 @@ use the *src/webapp/middleware/redirect-if-not- authenticated.js* middleware to export default { middleware: ['redirect-if-not-authenticated'], } -``` \ No newline at end of file +``` diff --git a/docs/docs/09_Files/2_Temporary Files.md b/docs/docs/09_Files/2_Temporary Files.md index 948c954d..62b5a5d9 100644 --- a/docs/docs/09_Files/2_Temporary Files.md +++ b/docs/docs/09_Files/2_Temporary Files.md @@ -16,14 +16,19 @@ use function Safe\unlink; protected function createResponseWithXLSXAttachment(string $filename, Xlsx $xlsx): Response { - $tmpFilename = Uuid::uuid4()->toString() . '.xlsx'; - $xlsx->save($tmpFilename); - $fileContent = file_get_contents($tmpFilename); // Get the file content. - unlink($tmpFilename); // Delete the file. - + try { + $tmpFilename = Uuid::uuid4()->toString() . '.xlsx'; + $xlsx->save($tmpFilename); + $fileContent = file_get_contents($tmpFilename); // Get the file content. + } finally { + if (file_exists($tmpFilename)) { + unlink($tmpFilename); // Delete the file. + } + } + return $this->createResponseWithAttachment( $filename, $fileContent ); } -``` \ No newline at end of file +``` diff --git a/docs/docs/16_Deployments/3_CICD.md b/docs/docs/16_Deployments/3_CICD.md index 7847d972..434c901c 100644 --- a/docs/docs/16_Deployments/3_CICD.md +++ b/docs/docs/16_Deployments/3_CICD.md @@ -16,7 +16,7 @@ stages: api_tests: stage: tests - image: thecodingmachine/php:7.4-v3-apache + image: thecodingmachine/php:7.4-v3-cli services: - name: mysql:8.0 command: ["--default-authentication-plugin=mysql_native_password"] @@ -141,4 +141,4 @@ webapp_build_push_docker_image_prod: variables: NUXTJS_ENV_CONTENT: "$NUXTJS_ENV_CONTENT_PROD" # .env file content for prod (from GitLab CI/CD variables). ENV_NAME: "prod" -``` \ No newline at end of file +``` diff --git a/src/api/README.md b/src/api/README.md index 30043135..124848b3 100644 --- a/src/api/README.md +++ b/src/api/README.md @@ -66,7 +66,7 @@ public function getDescription() : string } ``` -And throw the following exception the `down` method: +And throw the following exception in the `down` method: ```php public function down(Schema $schema) : void @@ -115,4 +115,4 @@ php bin/console app:fixtures:dev It uses the class [AppFixtures.php](src/Infrastructure/Fixtures/AppFixtures.php) for that task. -You should edit according to your needs. \ No newline at end of file +You should edit according to your needs.