Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
name: CI for AnzuSystems Common Bundle by Petit Press a.s. (www.sme.sk)

on:
push:
branches:
- main
pull_request:
branches:
- main

# Cancels previously running jobs for the same PR if a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Follows the principle of least privilege
permissions:
contents: read

jobs:
build:
name: PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
container: ${{ matrix.docker-image }}

strategy:
matrix:
include:
- php-version: 8.4
- php-version: '8.4'
docker-image: 'anzusystems/php:5.0.1-php84-cli'
- php-version: 8.5
- php-version: '8.5'
docker-image: 'anzusystems/php:5.0.1-php85-cli'

services:
Expand All @@ -34,25 +50,21 @@ jobs:
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: admin

name: PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
container: ${{ matrix.docker-image }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate composer.json
run: composer validate
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock', '**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-php-${{ matrix.php-version }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-ansi --no-interaction --no-scripts
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ext-pcntl": "*",
"ext-redis": "*",
"ext-zend-opcache": "*",
"anzusystems/contracts": "^4.0",
"anzusystems/contracts": "^4.5",
"anzusystems/serializer-bundle": "^6.0",
"doctrine/dbal": "^4.0",
"doctrine/lexer": "^3.0",
Expand All @@ -38,7 +38,7 @@
"symfony/http-kernel": "^7.0|^8.0",
"symfony/lock": "^7.0|^8.0",
"symfony/messenger": "^7.0|^8.0",
"symfony/monolog-bundle": ">=3.9",
"symfony/monolog-bundle": "^3.9|^4.0",
"symfony/polyfill-uuid": "^1.23",
"symfony/runtime": "^7.0|^8.0",
"symfony/security-bundle": "^7.0|^8.0",
Expand Down
1 change: 1 addition & 0 deletions src/Domain/User/AbstractUserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function updateBaseAnzuUser(AnzuUser $user, BaseUserDto $userDto, bool $f
{
$user
->setEmail($userDto->getEmail())
->setLocale($userDto->getLocale())
;
$user->getAvatar()
->setColor($userDto->getAvatar()->getColor())
Expand Down
17 changes: 17 additions & 0 deletions src/Model/User/BaseUserDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class BaseUserDto
#[Assert\Valid]
#[Serialize]
protected Avatar $avatar;

#[Assert\Locale(message: ValidationException::ERROR_FIELD_INVALID)]
#[Serialize]
protected ?string $locale = null;
protected string $resourceName = '';

public function __construct()
Expand All @@ -55,6 +59,7 @@ public static function createFromUser(AnzuUser $user): static
->setEmail($user->getEmail())
->setPerson($user->getPerson())
->setAvatar($user->getAvatar())
->setLocale($user->getLocale())
->setResourceName($user::getResourceName())
;
}
Expand Down Expand Up @@ -107,6 +112,18 @@ public function setAvatar(Avatar $avatar): static
return $this;
}

public function getLocale(): ?string
{
return $this->locale;
}

public function setLocale(?string $locale): static
{
$this->locale = $locale;

return $this;
}

#[Serialize(serializedName: '_resourceName')]
public function getResourceName(): string
{
Expand Down
3 changes: 3 additions & 0 deletions tests/data/Fixtures/UserFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private function getData(): Generator
$consoleUser = (new User())
->setEmail('console@anzusystems.sk')
->setId(AnzuApp::getUserIdConsole())
->setLocale('sk')
->setCreatedAt(AnzuApp::getAppDate())
->setModifiedAt(AnzuApp::getAppDate())
;
Expand All @@ -54,6 +55,7 @@ private function getData(): Generator
yield (new User())
->setEmail('anonymous@anzusystems.sk')
->setId(AnzuApp::getUserIdAnonymous())
->setLocale('sk')
->setCreatedAt(AnzuApp::getAppDate())
->setModifiedAt(AnzuApp::getAppDate())
->setCreatedBy($consoleUser)
Expand All @@ -63,6 +65,7 @@ private function getData(): Generator
->setId(AnzuApp::getUserIdAdmin())
->setEmail('admin@anzusystems.sk')
->setRoles([User::ROLE_ADMIN])
->setLocale('sk')
->setCreatedAt(AnzuApp::getAppDate())
->setModifiedAt(AnzuApp::getAppDate())
->setCreatedBy($consoleUser)
Expand Down
Loading