Merge branch 'main' into fix/xdebug-profiling

This commit is contained in:
2024-08-13 15:20:36 +02:00
12 changed files with 797 additions and 213 deletions
+3
View File
@@ -36,3 +36,6 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
STRIPE_API_KEY=""
STRIPE_WEBHOOK_SECRET=""
# doctrine-encrypt-bundle
DOCTRINE_ENCRYPT_KEY=""
+1
View File
@@ -4,3 +4,4 @@ APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
CRYPTO_SECRET="CryptoSecret"
+4
View File
@@ -26,3 +26,7 @@
###> XDebug ###
/cachegrind*
###< XDebug ###
###> doctrineencryptbundle/doctrine-encrypt-bundle
.Halite.key
###< doctrineencryptbundle/doctrine-encrypt-bundle
+1
View File
@@ -15,6 +15,7 @@
"doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^2.19",
"doctrineencryptbundle/doctrine-encrypt-bundle": "^5.4",
"nelmio/cors-bundle": "^2.3",
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.24",
Generated
+618 -193
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -12,4 +12,5 @@ return [
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Ambta\DoctrineEncryptBundle\AmbtaDoctrineEncryptBundle::class => ['all' => true],
];
@@ -0,0 +1,11 @@
ambta_doctrine_encrypt:
# If you want, you can use your own Encryptor. Encryptor must implements EncryptorInterface interface
# Default: Halite
# encryptor_class: Halite
# Path where to store the keyfiles
# Default: '%kernel.project_dir%'
# secret_directory_path: '%kernel.project_dir%'
# Secret string
secret: '%env(CRYPTO_SECRET)%'
+11 -20
View File
@@ -1,38 +1,29 @@
FROM php:8.2.19-fpm
FROM php:8.3-fpm
# System dependencies
RUN apt update && apt install -y \
curl
RUN apt-get update && apt install -y curl git
# PHP extensions
## OPcache
RUN docker-php-ext-install \
opcache
RUN docker-php-ext-install opcache
## XDebug
RUN pecl install \
xdebug \
&& docker-php-ext-enable \
xdebug
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
## PDO & mysql
RUN docker-php-ext-install \
pdo pdo_mysql
RUN docker-php-ext-install pdo pdo_mysql
# Zip
RUN apt install -y \
libzip-dev zip unzip \
&& docker-php-ext-install \
zip
RUN apt-get install -y libzip-dev zip unzip \
&& docker-php-ext-install zip
# Intl
RUN apt install -y \
libicu-dev \
&& docker-php-ext-install \
intl
RUN apt-get install -y libicu-dev \
&& docker-php-ext-install intl
# Composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
WORKDIR /app
WORKDIR /app
+20
View File
@@ -145,6 +145,9 @@ class User implements UserInterface, UserOwnedInterface, PasswordAuthenticatedUs
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: Project::class)]
private Collection $projects;
#[ORM\OneToOne(mappedBy: 'user', cascade: ['persist', 'remove'])]
private ?UserPersonal $personalData = null;
public function __construct()
{
$this->migrated = false;
@@ -411,4 +414,21 @@ class User implements UserInterface, UserOwnedInterface, PasswordAuthenticatedUs
return $this;
}
public function getPersonalData(): ?UserPersonal
{
return $this->personalData;
}
public function setPersonalData(UserPersonal $personalData): static
{
// set the owning side of the relation if necessary
if ($personalData->getUser() !== $this) {
$personalData->setUser($this);
}
$this->personalData = $personalData;
return $this;
}
}
+92
View File
@@ -0,0 +1,92 @@
<?php
namespace App\Entity;
use Ambta\DoctrineEncryptBundle\Configuration\Encrypted;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\UserPersonalRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* UserPersonal is the detailed data of a User.
*
* The personal data of a user will be kept encrypted
*/
#[ORM\Entity(repositoryClass: UserPersonalRepository::class)]
#[ApiResource]
class UserPersonal
{
#[ORM\Id]
#[ORM\OneToOne(inversedBy: 'personalData', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
/**
* The Identity Document number of the User.
*/
#[ORM\Column(length: 255, nullable: true)]
#[Encrypted]
private ?string $identityDocument = null;
/**
* The type of indentity document that the User has, ie: Passport, DNI, NIE, etc.
*/
#[ORM\Column(length: 255, nullable: true)]
#[Encrypted]
private ?string $identityDocumentType = null;
/**
* The Postal Code of where the User lives.
*/
#[ORM\Column(length: 255, nullable: true)]
#[Encrypted]
private ?string $postalCode = null;
public function getUser(): ?User
{
return $this->user;
}
public function setUser(User $user): static
{
$this->user = $user;
return $this;
}
public function getIdentityDocument(): ?string
{
return $this->identityDocument;
}
public function setIdentityDocument(?string $identityDocument): static
{
$this->identityDocument = $identityDocument;
return $this;
}
public function getIndetityDocumentType(): ?string
{
return $this->identityDocumentType;
}
public function setIndetityDocumentType(?string $identityDocumentType): static
{
$this->identityDocumentType = $identityDocumentType;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): static
{
$this->postalCode = $postalCode;
return $this;
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Repository;
use App\Entity\UserPersonal;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<UserPersonal>
*
* @method UserPersonal|null find($id, $lockMode = null, $lockVersion = null)
* @method UserPersonal|null findOneBy(array $criteria, array $orderBy = null)
* @method UserPersonal[] findAll()
* @method UserPersonal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserPersonalRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, UserPersonal::class);
}
}
+12
View File
@@ -13,6 +13,15 @@
"src/ApiResource/.gitignore"
]
},
"doctrine/annotations": {
"version": "2.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.10",
"ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05"
}
},
"doctrine/doctrine-bundle": {
"version": "2.12",
"recipe": {
@@ -40,6 +49,9 @@
"migrations/.gitignore"
]
},
"doctrineencryptbundle/doctrine-encrypt-bundle": {
"version": "5.4.0"
},
"friendsofphp/php-cs-fixer": {
"version": "3.58",
"recipe": {