Skip to content
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

Proposal for verion 6.0.0 #29

Open
wants to merge 44 commits into
base: 6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
356d911
Proposal for verion 6.0.0
r3hp1c Mar 2, 2024
6c36fdc
add paragonie/halite to composer.json for demos
r3hp1c Mar 2, 2024
b06779f
update PHPCompatibility to 8.3
r3hp1c Mar 2, 2024
a323395
add paragonie/halite 4.6 to composer.json
r3hp1c Mar 2, 2024
d7fe8ac
attempt to fix: TypeError: Argument 2 passed to DoctrineEncryptBundle…
r3hp1c Mar 2, 2024
daa7dd3
attempt to fix: TypeError: Return value of DoctrineEncryptBundle\Serv…
r3hp1c Mar 2, 2024
6cb1549
attempt to fix: LogicException: Lazy ghost objects cannot be enabled …
r3hp1c Mar 2, 2024
c0614ce
undo attempt to fix: LogicException: Lazy ghost objects cannot be ena…
r3hp1c Mar 2, 2024
238a0ca
attempt to fix: LogicException: The attribute metadata driver cannot …
r3hp1c Mar 2, 2024
cf95fe5
attempt to fix: Error: Call to undefined method Doctrine\ORM\Configur…
r3hp1c Mar 2, 2024
be06180
attempt to fix: Error: Class 'Doctrine\ORM\ORMSetup' not found
r3hp1c Mar 2, 2024
dcbb0ba
attempt to fix: Error: Call to protected Doctrine\ORM\EntityManager::…
r3hp1c Mar 2, 2024
b6cd9c3
Added back some annotations to try and fix some checks
r3hp1c Mar 2, 2024
7140f01
Added back some annotations to try and fix some checks
r3hp1c Mar 2, 2024
5fd44bd
attempt to fix: TypeError: Return value of DoctrineEncryptBundle\Type…
r3hp1c Mar 2, 2024
645c790
attempt to fix: Error: Call to undefined method Doctrine\DBAL\Stateme…
r3hp1c Mar 2, 2024
be4876c
Added back some annotations to try and fix some checks
r3hp1c Mar 2, 2024
63a1284
attempt to fix checks failing after tests pass due to deprecation not…
r3hp1c Mar 2, 2024
8436bc5
attempt to fix: LogicException: Lazy ghost objects cannot be enabled …
r3hp1c Mar 2, 2024
e5d6ab3
Dropped PHP support below 8.1 and old code that caused deprecation no…
r3hp1c Mar 3, 2024
f1fffbb
Fix for the commands to not use ClassMetadata::CHANGETRACKING_NOTIFY …
r3hp1c Mar 3, 2024
bf092c6
Add paragonie/halite for the symfony 7 demos
r3hp1c Mar 3, 2024
4b39cdc
Symfony 7 tests to run on PHP version 8.2 and 8.3. Fixed Doctrine 3 R…
r3hp1c Mar 3, 2024
f66e6ce
Fix PHP version in composer.json
r3hp1c Mar 3, 2024
e71725c
Changed Doctrine ORM 3 ManagerRegistry
r3hp1c Mar 3, 2024
e59f122
Fix vendor/bin/phpcs testVarsion to 8.1-8.3
r3hp1c Mar 3, 2024
a1ca496
Added phpcompatibility/php-compatibility version 8.2 in an attempt to…
r3hp1c Mar 3, 2024
d1137a8
8.1 lowest attempt to fix: 'php-compatibility handling the post-updat…
r3hp1c Mar 3, 2024
c1ef83d
Fix 8.1 lowest tests
r3hp1c Mar 3, 2024
c847ee5
Symfony 5.4 remove enable_lazy_ghost_objects
r3hp1c Mar 3, 2024
f41a380
Add lowest doctrine/annotations 1.18
r3hp1c Mar 3, 2024
5a81556
Attempt to fix lowest test error: Attempted to call an undefined meth…
r3hp1c Mar 3, 2024
f131cc4
Add lowest doctrine/annotations 1.13
r3hp1c Mar 3, 2024
cc4eb76
symfony/phpunit-bridge to 7.0.4
r3hp1c Mar 3, 2024
f13b8cb
symfony flex minimum version 2.2
r3hp1c Mar 3, 2024
55a0809
symfony flex minimum version 2.2
r3hp1c Mar 3, 2024
966ba2a
Symfony 6.4 remove enable_lazy_ghost_objects
r3hp1c Mar 3, 2024
c0e4211
Updated composer.json versions
r3hp1c Mar 3, 2024
75a63e1
added maker bundle back
r3hp1c Mar 3, 2024
e02069f
symfony 7.x phpunit.xml.dist for symfony 6.x
r3hp1c Mar 3, 2024
29e2c8a
Moved maker-bundle to the symfony 6.x composer.json
r3hp1c Mar 3, 2024
8ac43bb
symfony 5.x phpunit.xml.dist for symfony 6.x
r3hp1c Mar 3, 2024
7dd62a6
Set KERNEL_CLASS
r3hp1c Mar 3, 2024
baa82b4
symfony/flex to version 2.3 for symfony 6.x
r3hp1c Mar 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 21 additions & 9 deletions .github/workflows/ci.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.0"
php-version: "8.1"

- name: "Validate composer.json"
run: "composer validate --strict --no-check-lock"
Expand All @@ -40,7 +40,7 @@ jobs:
run: "vendor/bin/phpstan analyze"

- name: "PHPCompatibility"
run: "vendor/bin/phpcs src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 7.2-8.1"
run: "vendor/bin/phpcs src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 8.1-8.3"

tests:
name: "Tests ${{ matrix.php-version }} ${{ matrix.dependency-versions }}"
Expand All @@ -51,16 +51,16 @@ jobs:
fail-fast: false
matrix:
# normal, highest, non-dev installs
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-version: ['8.1', '8.2', '8.3']
composer-options: ['--prefer-stable']
dependency-versions: ['highest']
include:
# testing lowest PHP version with lowest dependencies
- php-version: '7.2.5'
- php-version: '8.1'
dependency-versions: 'lowest'
composer-options: '--prefer-lowest'
env:
SYMFONY_PHPUNIT_VERSION: 7
SYMFONY_PHPUNIT_VERSION: 9

steps:
- name: "Checkout code"
Expand All @@ -85,7 +85,7 @@ jobs:
- name: Unit Tests
run: vendor/bin/simple-phpunit
env:
SYMFONY_PHPUNIT_VERSION: "${{ matrix.dependency-versions == 'lowest' && '7' || '' }}"
SYMFONY_PHPUNIT_VERSION: "${{ matrix.dependency-versions == 'lowest' && '9' || '' }}"

- name: Install symlinks for demo's
uses: "ramsey/composer-install@v2"
Expand All @@ -104,7 +104,7 @@ jobs:
- name: Demo symfony5.4 - Unit Tests
run: demo/symfony5.4/bin/phpunit -c demo/symfony5.4/phpunit.xml.dist
env:
SYMFONY_PHPUNIT_VERSION: "${{ matrix.dependency-versions == 'lowest' && '7' || '' }}"
SYMFONY_PHPUNIT_VERSION: "${{ matrix.dependency-versions == 'lowest' && '9' || '' }}"

- name: Demo symfony6.x - Install dependencies
uses: "ramsey/composer-install@v2"
Expand All @@ -124,8 +124,20 @@ jobs:
dependency-versions: "${{ matrix.dependency-versions }}"
composer-options: "--prefer-dist --no-progress"
working-directory: "demo/symfony7.x"
if: ${{ startsWith(matrix.php-version , '8.2') }}
if: ${{ matrix.php-version == '8.2' || matrix.php-version == '8.3' }}

- name: Demo symfony7.x - Unit Tests
run: demo/symfony7.x/vendor/bin/simple-phpunit -c demo/symfony7.x/phpunit.xml.dist
if: ${{ startsWith(matrix.php-version , '8.2') }}
if: ${{ matrix.php-version == '8.2' || matrix.php-version == '8.3' }}

- name: Demo symfony7.x Doctrine3.x - Install dependencies
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependency-versions }}"
composer-options: "--prefer-dist --no-progress"
working-directory: "demo/symfony7.x_doctrine3.x"
if: ${{ matrix.php-version == '8.2' || matrix.php-version == '8.3' }}

- name: Demo symfony7.x Doctrine3.x - Unit Tests
run: demo/symfony7.x_doctrine3.x/vendor/bin/simple-phpunit -c demo/symfony7.x_doctrine3.x/phpunit.xml.dist
if: ${{ matrix.php-version == '8.2' || matrix.php-version == '8.3' }}
13 changes: 5 additions & 8 deletions .travis.yml
Expand Up @@ -8,10 +8,10 @@ matrix:
fast_finish: true
include:
# Minimum supported versions
- php: 7.2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO we can remove travis CI as we have GitHub CI for years.

The project also seems dead https://app.travis-ci.com/DoctrineEncryptBundle/DoctrineEncryptBundle

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing that. Will get that done.

- php: 8.1
env: COMPOSER_FLAGS="--prefer-lowest"
## with sodium extension installed.
- php: 7.2
- php: 8.1
env: COMPOSER_FLAGS="--prefer-lowest"
before_install:
- sudo add-apt-repository ppa:ondrej/php -y
Expand All @@ -23,17 +23,14 @@ matrix:
- printf "\n" | pecl install libsodium
- composer update $COMPOSER_FLAGS --prefer-dist --no-interaction

- php: 7.3
- php: 8.2
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"

- php: 7.4
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"

- php: 8.0
- php: 8.3
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"

# Latest commit to master
- php: 7.3
- php: 8.1
env: STABILITY="dev"

allow_failures:
Expand Down
21 changes: 10 additions & 11 deletions composer.json
Expand Up @@ -5,25 +5,24 @@
"license": "MIT",
"description": "Encrypted symfony entity's by verified and standardized libraries",
"require": {
"php": "^7.2|^8.0",
"paragonie/halite": "^4.6|^5.0",
"doctrine/orm": "^2.5",
"php": "^8.1",
"doctrine/orm": "^2.18|^3.0",
"doctrine/doctrine-bundle": "^2.0.8|^2.1",
"symfony/property-access": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/yaml": "^5.4|^6.0|^7.0",
"symfony/http-kernel": "^5.4|^6.0|^7.0",
"symfony/config": "^5.4|^6.0|^7.0",
"doctrine/annotations": "^1.13|^2.0",
"symfony/expression-language": "^5.4|^6.0|^7.0"
"symfony/config": "^5.4|^6.0|^7.0"
},
"require-dev": {
"paragonie/halite": "^4.6|^5.0",
"defuse/php-encryption": "^2.1",
"doctrine/cache": "^1.11",
"phpstan/phpstan": "^1.4",
"jetbrains/phpstorm-attributes": "^1.0",
"phpcompatibility/php-compatibility": "^9.3",
"symfony/phpunit-bridge": "^7.0"
"squizlabs/php_codesniffer": "^3.8",
"symfony/phpunit-bridge": "^7.0.4",
"symfony/expression-language": "^5.4|^6.0|^7.0"
},
"suggest": {
"defuse/php-encryption": "Alternative for halite for use with older php-versions",
Expand All @@ -32,17 +31,17 @@
},
"autoload": {
"psr-4": {
"Ambta\\DoctrineEncryptBundle\\": "src/"
"DoctrineEncryptBundle\\": "src/"
}
},
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"phpcs-compatibility-test" : "vendor/bin/phpcs src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 7.2-8.1"
"phpcs-compatibility-test" : "vendor/bin/phpcs src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 8.1-8.3"
},
"autoload-dev": {
"psr-4": {
"Ambta\\DoctrineEncryptBundle\\Tests\\": "tests/"
"DoctrineEncryptBundle\\Tests\\": "tests/"
}
},
"config": {
Expand Down
8 changes: 6 additions & 2 deletions demo/composer.json
Expand Up @@ -19,17 +19,21 @@
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony6.x/.env.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony6.x/.env.test.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony7.x/.env.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony7.x/.env.test.local"
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony7.x/.env.test.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony7.x_doctrine3.x/.env.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony7.x_doctrine3.x/.env.test.local"
]
},
"extra": {
"symlinks": {
"shared/templates": "symfony5.4/templates",
"./shared/templates": "symfony6.x/templates",
"././shared/templates": "symfony7.x/templates",
"./././shared/templates": "symfony7.x_doctrine3.x/templates",
"shared/var/data.db": "symfony5.4/var/data.db",
"./shared/var/data.db": "symfony6.x/var/data.db",
"././shared/var/data.db": "symfony7.x/var/data.db"
"././shared/var/data.db": "symfony7.x/var/data.db",
"./././shared/var/data.db": "symfony7.x_doctrine3.x/var/data.db"
}
}
}
12 changes: 7 additions & 5 deletions demo/symfony5.4/composer.json
Expand Up @@ -4,22 +4,24 @@
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"php": "^8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/orm": "^2.13",
"doctrineencryptbundle/doctrine-encrypt-bundle": "@dev",
"doctrine/persistence": "^3.2",
"paragonie/halite": "^4.6|^5.0",
"paragonie/halite": "^4.6",
"symfony/console": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/flex": "^1.21|^2",
"symfony/flex": "^2.2",
"symfony/framework-bundle": "5.4.*",
"symfony/runtime": "5.4.*",
"symfony/twig-bundle": "5.4.*",
"symfony/yaml": "5.4.*"
"symfony/yaml": "5.4.*",
"doctrine/annotations": "^1.13|^2.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^7.0"
"symfony/phpunit-bridge": "^7.0.4"
},
"config": {
"allow-plugins": {
Expand Down
2 changes: 1 addition & 1 deletion demo/symfony5.4/config/bundles.php
Expand Up @@ -4,5 +4,5 @@
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Ambta\DoctrineEncryptBundle\AmbtaDoctrineEncryptBundle::class => ['all' => true],
DoctrineEncryptBundle\DoctrineEncryptBundle::class => ['all' => true],
];
3 changes: 0 additions & 3 deletions demo/symfony5.4/config/packages/ambta_doctrine_encrypt.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions demo/symfony5.4/config/packages/doctrine.yaml
Expand Up @@ -6,6 +6,7 @@ doctrine:
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '15'
orm:
# enable_lazy_ghost_objects: true
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
Expand All @@ -16,6 +17,12 @@ doctrine:
dir: '%kernel.project_dir%/src/Entity/Annotation'
prefix: 'App\Entity\Annotation'
alias: App
Attributes:
type: 'attribute'
is_bundle: false
dir: '%kernel.project_dir%/src/Entity/Attribute'
prefix: 'App\Entity\Attribute'
alias: App

when@test:
doctrine:
Expand Down
3 changes: 3 additions & 0 deletions demo/symfony5.4/config/packages/doctrine_encrypt.yaml
@@ -0,0 +1,3 @@
doctrine_encrypt:
enable_secret_generation: false
secret: '%env(HALITE_SECRET)%'
16 changes: 0 additions & 16 deletions demo/symfony5.4/config/packages/php8/doctrine.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions demo/symfony5.4/src/Entity/Annotation/Secret.php
Expand Up @@ -2,7 +2,6 @@

namespace App\Entity\Annotation;

use Ambta\DoctrineEncryptBundle\Configuration\Encrypted;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\Annotation\SecretRepository;

Expand All @@ -19,8 +18,7 @@ class Secret implements \App\Entity\SecretInterface
private $name;

/**
* @ORM\Column(type="string",nullable=false)
* @Encrypted
* @ORM\Column(type="encrypted",nullable=false)
*/
private $secret;

Expand Down
4 changes: 1 addition & 3 deletions demo/symfony5.4/src/Entity/Attribute/Secret.php
Expand Up @@ -2,7 +2,6 @@

namespace App\Entity\Attribute;

use Ambta\DoctrineEncryptBundle\Configuration\Encrypted;
use App\Repository\Attribute\SecretRepository;
use Doctrine\ORM\Mapping as ORM;

Expand All @@ -15,8 +14,7 @@ class Secret implements \App\Entity\SecretInterface
private $name;


#[ORM\Column(type:"string", nullable:false)]
#[Encrypted]
#[ORM\Column(type:"encrypted", nullable:false)]
private $secret;

/**
Expand Down
11 changes: 2 additions & 9 deletions demo/symfony5.4/src/Repository/Annotation/SecretRepository.php
Expand Up @@ -4,14 +4,7 @@

use App\Entity\Annotation\Secret;
use App\Repository\AbstractSecretRepository;

// Alias is needed because of test with both php 7.2, 7.4 and 8.0
if (!interface_exists('\Doctrine\Common\Persistence\ManagerRegistry')) {
class_alias(
'\Doctrine\Persistence\ManagerRegistry',
'\Doctrine\Common\Persistence\ManagerRegistry'
);
}
use Doctrine\Persistence\ManagerRegistry;

/**
* @method Secret|null find($id, $lockMode = null, $lockVersion = null)
Expand All @@ -20,7 +13,7 @@ class_alias(
*/
class SecretRepository extends AbstractSecretRepository
{
public function __construct(\Doctrine\Common\Persistence\ManagerRegistry $registry)
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Secret::class);
}
Expand Down
4 changes: 2 additions & 2 deletions demo/symfony5.4/tests/SecretTest.php
Expand Up @@ -2,7 +2,7 @@

namespace App\Tests;

use Ambta\DoctrineEncryptBundle\Subscribers\DoctrineEncryptSubscriber;
use DoctrineEncryptBundle\Service\Encrypt;
use App\Entity;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand Down Expand Up @@ -53,7 +53,7 @@ private function testSecretsAreEncryptedInDatabase(string $className)
self::assertEquals($newSecretObject->getName(), $actualSecretObject->getName());
// Make sure it is encrypted
self::assertNotEquals($newSecretObject->getSecret(),$actualRawSecret);
self::assertStringEndsWith(DoctrineEncryptSubscriber::ENCRYPTION_MARKER,$actualRawSecret);
self::assertStringEndsWith(Encrypt::ENCRYPTION_MARKER,$actualRawSecret);
}

/**
Expand Down
23 changes: 14 additions & 9 deletions demo/symfony6.x/composer.json
Expand Up @@ -4,20 +4,25 @@
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.0.2",
"php": "^8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/orm": "^2.13",
"doctrineencryptbundle/doctrine-encrypt-bundle": "@dev",
"symfony/console": "6.0.*",
"symfony/dotenv": "6.0.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.0.*",
"symfony/runtime": "6.0.*",
"symfony/twig-bundle": "6.0.*"
"doctrine/persistence": "^3.2",
"paragonie/halite": "^5.0",
"symfony/console": "6.4.*",
"symfony/dotenv": "6.4.*",
"symfony/flex": "^2.3",
"symfony/framework-bundle": "6.4.*",
"symfony/runtime": "6.4.*",
"symfony/twig-bundle": "6.4.*",
"symfony/yaml": "6.4.*",
"doctrine/annotations": "^1.13|^2.0"
},
"require-dev": {
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^7.0"
"symfony/phpunit-bridge": "^7.0.4"
},
"config": {
"allow-plugins": {
Expand Down Expand Up @@ -67,7 +72,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.0.*"
"require": "6.4.*"
}
},
"repositories": [
Expand Down