Skip to content

Conversation

@alexander-schranz
Copy link
Member

@alexander-schranz alexander-schranz commented Feb 16, 2023

TODO

  • Error: Call to undefined method Doctrine\Common\Annotations\AnnotationRegistry::registerLoader() PHP 7.3
  • Error: Class "Doctrine\Common\Annotations\CachedReader" does not exist
  • Error: You have requested a non-existent parameter "container.build_id".

require atleast 1.13 and update CachedReader to the with PSRCachedReader: doctrine/annotations@c66f06b.

This requires that we move from doctrine/cache to symfony/cache psr cache think metadata can use the symfony system cache.

In this case i completely removed the requirement to doctrine/cache and replaced it in all cases with the PSRCacheReader. This is a small BC break which should mostly not have effects on existing systems. Still I would go here with a new Minor release so somebody could still require 5.4.* when still want to use doctrine/cache or older annotations version.

@alexander-schranz alexander-schranz added enhancement New feature or request help wanted Extra attention is needed labels Feb 16, 2023
@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch from 69e7c46 to c5be651 Compare June 13, 2023 21:39
- php-version: '7.2'
elasticsearch-version: '5.6.14'
lint: false
symfony-version: '^2.8'
Copy link
Member Author

Choose a reason for hiding this comment

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

support for Symfony 2 dropped because of requirement to symfony/cache

@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch 2 times, most recently from f04b5c8 to 7167d69 Compare June 13, 2023 21:43
Comment on lines 32 to 46
$hasContainerBuildId = $container->hasParameter('container.build_id');
if (!$hasContainerBuildId) {
// the 'container.build_id' is required for `es.cache_engine` system cache which normally can not
// be constructor inside a compiler pass. This is a workaround to make it work.
// see also:
// - https://github.com/symfony/symfony/blob/52a92926f7fed15cdff399c6921100a10e0d6f61/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L389
// - https://github.com/symfony/symfony/blob/52a92926f7fed15cdff399c6921100a10e0d6f61/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L2322
$hasContainerBuildId = true;
$container->setParameter('container.build_id', hash('crc32', 'Abc123' . time()));
}

$collector = $container->get('es.metadata_collector');
if (!$hasContainerBuildId) {
$container->getParameterBag()->remove('container.build_id');
}
Copy link
Member Author

@alexander-schranz alexander-schranz Jun 13, 2023

Choose a reason for hiding this comment

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

This is required when using the cache.system and access it inside the compile time. Another possibility would be to use the cache.app but which does not require build_id. But metadata normally is invalidated between deployments and should fast readable which normally is job of the cache.system and not the cache.app.

You have requested a non-existent parameter "container.build_id".

@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch from aef3071 to adeb229 Compare June 13, 2023 22:00
@alexander-schranz alexander-schranz marked this pull request as ready for review June 13, 2023 22:09
Comment on lines +99 to +128
- name: Composer require
if: ${{ matrix.symfony-version == '^4.4' }}
# symfony 4.4 not compatible with doctrine/annotations 2.0: https://github.com/symfony/symfony/issues/48717#issuecomment-1359164836
run: |
composer require --no-update doctrine/annotations:^1.10
Copy link
Member Author

@alexander-schranz alexander-schranz Jun 13, 2023

Choose a reason for hiding this comment

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

Required for: Error: Call to undefined method Doctrine\Common\Annotations\AnnotationRegistry::registerLoader() in PHP 7.3 with Symfony 4.4

@alexander-schranz alexander-schranz changed the title Add support for doctrine/annotations 2.0 Add support for doctrine/annotations 2.0 and remove requirement to doctrine/cache Jun 13, 2023
@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch from 0b41a5f to 7bc87fa Compare June 13, 2023 22:19
@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch from 7bc87fa to 11de7a1 Compare June 13, 2023 22:21
@alexander-schranz alexander-schranz removed the help wanted Extra attention is needed label Jun 14, 2023
@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch from 11de7a1 to 6cc7081 Compare December 10, 2024 14:26
@alexander-schranz
Copy link
Member Author

The tests are failing because ES7 does not support some features of this bundle. But looks like it the same as on current 5.x branch: #38

@alexander-schranz alexander-schranz force-pushed the enhancement/support-doctrine-annotations-2-0 branch from 8817569 to 1f2dc99 Compare December 10, 2024 14:39
@Prokyonn Prokyonn merged commit 0fbb9b6 into handcraftedinthealps:5.x Dec 11, 2024
3 of 9 checks passed
@alexander-schranz alexander-schranz deleted the enhancement/support-doctrine-annotations-2-0 branch December 11, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants