Skip to content

Commit

Permalink
feat: Bump min version supported by Doctrine/PHPCR to 2.0 (#273)
Browse files Browse the repository at this point in the history
Seeing how little changes in the tests the library is still compatible
with 1.x so it should not require any changes. However for executing the
tests, to ligthen the burden on this library, I am migrating to 2.0
minimum which removes support for annotations in favour of attributes.
  • Loading branch information
theofidry authored Nov 13, 2024
1 parent 3f1810b commit fb3e700
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Supports:
* Symfony 6.4+
* Doctrine ORM 2.5+
* Doctrine ODM 2.0+
* Doctrine PHPCR 1.4+
* Doctrine PHPCR 2.0+
* Eloquent 8.12+


Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"conflict": {
"doctrine/orm": "<2.6.3",
"doctrine/phpcr-odm": "<2.0.0",
"doctrine/dbal": "<3.0",
"doctrine/persistence": "<2.0",
"illuminate/database": "<8.12",
Expand Down
1 change: 1 addition & 0 deletions doctrine-phpcr-db-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
'dbname' => get_param('DOCTRINE_PHPCR_DB_NAME', 'fidry_alice_data_fixtures'),
'host' => get_param('DOCTRINE_PHPCR_DB_HOST', '127.0.0.1'),
'port' => get_param('DOCTRINE_PHPCR_DB_PORT', 3307),
'charset' => get_param('DOCTRINE_PHPCR_DB_CHARSET', 'utf8mb4'),
];
12 changes: 4 additions & 8 deletions fixtures/Bridge/Doctrine/PhpCrDocument/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@

namespace Fidry\AliceDataFixtures\Bridge\Doctrine\PhpCrDocument;

use Doctrine\ODM\PHPCR\Mapping\Annotations\Document;
use Doctrine\ODM\PHPCR\Mapping\Annotations\Id;
use Doctrine\ODM\PHPCR\Mapping\Attributes\Document;
use Doctrine\ODM\PHPCR\Mapping\Attributes\Id;

/**
* @Document()
*/
#[Document]
class Dummy
{
/**
* @Id()
*/
#[Id]
public $id;
}
6 changes: 2 additions & 4 deletions fixtures/Bridge/Doctrine/PhpCrDocument/DummySubClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@

namespace Fidry\AliceDataFixtures\Bridge\Doctrine\PhpCrDocument;

use Doctrine\ODM\PHPCR\Mapping\Annotations\Document;
use Doctrine\ODM\PHPCR\Mapping\Attributes\Document;

/**
* @Document()
*/
#[Document]
class DummySubClass extends MappedSuperclassDummy
{
}
18 changes: 6 additions & 12 deletions fixtures/Bridge/Doctrine/PhpCrDocument/MappedSuperclassDummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@

namespace Fidry\AliceDataFixtures\Bridge\Doctrine\PhpCrDocument;

use Doctrine\ODM\PHPCR\Mapping\Annotations\Field;
use Doctrine\ODM\PHPCR\Mapping\Annotations\Id;
use Doctrine\ODM\PHPCR\Mapping\Annotations\MappedSuperclass;
use Doctrine\ODM\PHPCR\Mapping\Attributes\Field;
use Doctrine\ODM\PHPCR\Mapping\Attributes\Id;
use Doctrine\ODM\PHPCR\Mapping\Attributes\MappedSuperclass;

/**
* @MappedSuperclass()
*/
#[MappedSuperclass]
class MappedSuperclassDummy
{
/**
* @Id()
*/
#[Id]
public $id;

/**
* @Field(type="string")
*/
#[Field(type: 'string')]
public string $status;
}
6 changes: 2 additions & 4 deletions tests/Bridge/DoctrinePhpCr/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@

$autoload = ROOT.'/vendor-bin/doctrine_phpcr/vendor/autoload.php';

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\DBAL\DriverManager;
use Doctrine\ODM\PHPCR\Configuration;
use Doctrine\ODM\PHPCR\DocumentManager;
use Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver;
use Doctrine\ODM\PHPCR\Mapping\Driver\AttributeDriver;
use Jackalope\RepositoryFactoryDoctrineDBAL;
use PHPCR\SessionInterface;
use PHPCR\SimpleCredentials;
Expand All @@ -42,8 +41,7 @@
})();

$config = (static function (): Configuration {
$driver = new AnnotationDriver(
new AnnotationReader(),
$driver = new AttributeDriver(
[
ROOT.'/vendor-bin/doctrine_phpcr/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Document',
ROOT.'/fixtures/Bridge/Doctrine/PhpCrDocument',
Expand Down

0 comments on commit fb3e700

Please sign in to comment.