Skip to content

Commit

Permalink
Merge pull request #824 from doctrine/symfony-6-branch-1.x
Browse files Browse the repository at this point in the history
Symfony 6
  • Loading branch information
dbu committed Dec 7, 2021
2 parents 377740f + 9d23652 commit 96baffa
Show file tree
Hide file tree
Showing 25 changed files with 318 additions and 116 deletions.
179 changes: 179 additions & 0 deletions .github/workflows/test-application.yaml
@@ -0,0 +1,179 @@
name: Test application

on:
pull_request:
push:
branches:
- 'master'

jobs:
phpunit-doctrine_dbal:
name: 'PHP ${{ matrix.php-version }} Doctrine DBAL ${{ matrix.dependencies }} Symfony ${{ matrix.symfony-version }}'

runs-on: ubuntu-20.04

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: phpcr_odm_tests
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false

matrix:
php-version:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
dependencies: [highest]
symfony-version: ['*']
include:
- php-version: '7.1'
dependencies: lowest
symfony-version: '*'
- php-version: '7.4'
dependencies: highest
symfony-version: 2.3.*
- php-version: '7.4'
dependencies: highest
symfony-version: 3.4.*
- php-version: '7.4'
dependencies: highest
symfony-version: 4.4.*
php-bench: true
- php-version: '8.0'
dependencies: highest
symfony-version: 5.0.*
- php-version: '8.0'
dependencies: highest
symfony-version: 6.0.*

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: 'composer:v2, flex'

- name: Symfony version
if: matrix.symfony-version != '*'
run: composer config extra.symfony.require ${{ matrix.symfony-version }}

- name: Install Jackalope Doctrine DBAL transport
run: composer require jackalope/jackalope-doctrine-dbal:"~1.0" --no-update

- name: Install PHPBench
if: matrix.php-bench == true
run: composer require phpbench/phpbench:"~0.16" --no-update

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Run configuration script
run: ./tests/script_doctrine_dbal.sh

- name: Execute test cases
run: vendor/bin/phpunit -c tests/phpunit_doctrine_dbal.xml.dist

- name: Execute PHPBench
if: matrix.php-bench == true
run: vendor/bin/phpbench run --report=all
env:
TRANSPORT: doctrine_dbal

phpunit-jackrabbit:
name: 'PHP ${{ matrix.php-version }} Jackrabbit ${{ matrix.dependencies }} Symfony ${{ matrix.symfony-version }}'

runs-on: ubuntu-20.04

strategy:
fail-fast: false

matrix:
php-version:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
dependencies: [highest]
symfony-version: ['*']
include:
- php-version: '7.1'
dependencies: lowest
symfony-version: '*'
- php-version: '7.4'
dependencies: highest
symfony-version: 2.3.*
- php-version: '7.4'
dependencies: highest
symfony-version: 3.4.*
php-bench: true
- php-version: '7.4'
dependencies: highest
symfony-version: 4.4.*
php-bench: true
- php-version: '8.0'
dependencies: highest
symfony-version: 5.0.*
- php-version: '8.0'
dependencies: highest
symfony-version: 6.0.*

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: 'composer:v2, flex'

- name: Symfony version
if: matrix.symfony-version != '*'
run: composer config extra.symfony.require ${{ matrix.symfony-version }}

- name: Install and configure Java
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: '8'

- name: Install Jackalope Jackrabbit
run: composer require jackalope/jackalope-jackrabbit:~1.0 --no-update

- name: Install PHPBench
if: matrix.php-bench == true
run: composer require phpbench/phpbench:"~0.16" --no-update

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Run configuration script
run: ./tests/script_jackrabbit.sh

- name: Execute test cases
run: vendor/bin/phpunit -c tests/phpunit_jackrabbit.xml.dist

- name: Execute PHPBench
if: matrix.php-bench == true
run: vendor/bin/phpbench run --report=all
env:
TRANSPORT: jackrabbit
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,12 @@
Changelog
=========

1.6.0
-----

* Support Symfony 6
* Drop support for Symfony 2.3

1.5.4
-----

Expand Down
2 changes: 1 addition & 1 deletion cli-config.doctrine_dbal.php.dist
Expand Up @@ -12,7 +12,7 @@ $extraCommands[] = new \Jackalope\Tools\Console\Command\InitDoctrineDbalCommand(

$params = array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'host' => '127.0.0.1',
'user' => 'root',
'password' => '',
'dbname' => 'phpcr_odm_tests',
Expand Down
2 changes: 1 addition & 1 deletion cli-config.jackrabbit.php.dist
Expand Up @@ -20,7 +20,7 @@ if (! isset($argv[1])
}

$params = array(
'jackalope.jackrabbit_uri' => 'http://localhost:8080/server/',
'jackalope.jackrabbit_uri' => 'http://127.0.0.1:8080/server/',
);

$workspace = 'default';
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Expand Up @@ -24,16 +24,16 @@
"phpcr/phpcr-implementation": "^2.1",
"phpcr/phpcr-utils": "^1.3.0",
"doctrine/instantiator": "^1.0.1",
"symfony/console": "^2.3 || ^3.0 || ^4.0 || ^5.0"
"symfony/console": "^3.4 || ^4.3 || ^5.0 || ^6.0"
},
"require-dev": {
"symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0",
"symfony/yaml": "^3.4 || ^4.3 || ^5.0 || ^6.0",
"symfony/phpunit-bridge": "^5.0",
"liip/rmt": "^1.2",
"phpunit/phpunit": "^7.0 || ^8.0"
"liip/rmt": "^1.3",
"phpunit/phpunit": "^7.5 || ^8.0"
},
"suggest": {
"symfony/yaml": "^3.4 || ^4.3 || ^5.0",
"symfony/yaml": "^3.4 || ^4.3 || ^5.0 || ^6.0",
"jackalope/jackalope-doctrine-dbal": "^1.3",
"jackalope/jackalope-jackrabbit": "^1.3"
},
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Children.php
Expand Up @@ -33,7 +33,7 @@ final class Children
public $filter;

/**
*@var int
* @var int
*/
public $fetchDepth = -1;

Expand Down
12 changes: 8 additions & 4 deletions lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php
Expand Up @@ -19,7 +19,6 @@

namespace Doctrine\ODM\PHPCR\Mapping;

use Doctrine\Common\ClassLoader;
use Doctrine\Instantiator\Instantiator;
use Doctrine\Instantiator\InstantiatorInterface;
use Doctrine\ODM\PHPCR\Event;
Expand Down Expand Up @@ -558,7 +557,7 @@ public function validateReferences()
{
foreach ($this->referenceMappings as $fieldName) {
$mapping = $this->mappings[$fieldName];
if (!empty($mapping['targetDocument']) && !ClassLoader::classExists($mapping['targetDocument'])) {
if (!empty($mapping['targetDocument']) && !class_exists($mapping['targetDocument']) && !interface_exists($mapping['targetDocument'])) {
throw MappingException::invalidTargetDocumentClass($mapping['targetDocument'], $this->name, $mapping['fieldName']);
}
}
Expand Down Expand Up @@ -1107,8 +1106,13 @@ public function validateClassMapping()
foreach ($this->referrersMappings as $referrerName) {
$mapping = $this->mappings[$referrerName];
// only a santiy check with reflection. otherwise we could run into endless loops
if (!ClassLoader::classExists($mapping['referringDocument'])) {
throw new MappingException(sprintf('Invalid referrer mapping on document "%s" for field "%s": The referringDocument class "%s" does not exist', $this->name, $mapping['fieldName'], $mapping['referringDocument']));
if (!class_exists($mapping['referringDocument']) && !interface_exists($mapping['referringDocument'])) {
throw new MappingException(sprintf(
'Invalid referrer mapping on document "%s" for field "%s": The referringDocument class "%s" does not exist',
$this->name,
$mapping['fieldName'],
$mapping['referringDocument']
));
}
$reflection = new ReflectionClass($mapping['referringDocument']);
if (!$reflection->hasProperty($mapping['referencedBy'])) {
Expand Down
8 changes: 6 additions & 2 deletions lib/Doctrine/ODM/PHPCR/Mapping/Driver/XmlDriver.php
Expand Up @@ -306,9 +306,13 @@ private function addReferenceMapping(ClassMetadata $class, $reference, $type)
protected function loadMappingFile($file)
{
$result = [];
$entity = libxml_disable_entity_loader(true);
if (\PHP_VERSION_ID < 80000) {
$entity = libxml_disable_entity_loader(true);
}
$xmlElement = simplexml_load_string(file_get_contents($file));
libxml_disable_entity_loader($entity);
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader($entity);
}

foreach (['document', 'mapped-superclass'] as $type) {
if (isset($xmlElement->$type)) {
Expand Down

0 comments on commit 96baffa

Please sign in to comment.