Skip to content

Commit

Permalink
feature: support symfony/dependency-injection 7.x (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif authored Feb 6, 2025
1 parent e7a7ab4 commit 40955c3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
17 changes: 17 additions & 0 deletions Grid/Export/ContainerAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace APY\DataGridBundle\Grid\Export;

use Symfony\Component\DependencyInjection\ContainerAwareInterface as SymfonyContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

if (interface_exists(SymfonyContainerAwareInterface::class)) {
interface ContainerAwareInterface extends SymfonyContainerAwareInterface
{
}
} else {
interface ContainerAwareInterface
{
public function setContainer(?ContainerInterface $container);
}
}
1 change: 0 additions & 1 deletion Grid/Export/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use APY\DataGridBundle\Grid\Column\ArrayColumn;
use APY\DataGridBundle\Grid\Grid;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Twig\TemplateWrapper;
Expand Down
2 changes: 1 addition & 1 deletion Grid/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
use APY\DataGridBundle\Grid\Column\ActionsColumn;
use APY\DataGridBundle\Grid\Column\Column;
use APY\DataGridBundle\Grid\Column\MassActionColumn;
use APY\DataGridBundle\Grid\Export\ContainerAwareInterface;
use APY\DataGridBundle\Grid\Export\Export;
use APY\DataGridBundle\Grid\Export\ExportInterface;
use APY\DataGridBundle\Grid\Source\Entity;
use APY\DataGridBundle\Grid\Source\Source;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
19 changes: 2 additions & 17 deletions Translation/ColumnTitleAnnotationTranslationExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@
use JMS\TranslationBundle\Model\Message;
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Extractor\FileVisitorInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ColumnTitleAnnotationTranslationExtractor implements FileVisitorInterface, \PHPParser_NodeVisitor, ContainerAwareInterface
class ColumnTitleAnnotationTranslationExtractor implements FileVisitorInterface, \PHPParser_NodeVisitor
{
private $annotated;
private $catalogue;
private $parsedClassName;

/**
* @var ContainerInterface
*/
private $container;

public function beforeTraverse(array $nodes)
{
$this->annotated = false;
Expand Down Expand Up @@ -68,7 +61,7 @@ public function visitPhpFile(\SplFileInfo $file, MessageCatalogue $catalogue, ar
if ($this->annotated) {
// Get annotations for the class
$annotationDriver = new Annotation(new DoctrineAnnotationReader());
$manager = new Manager($this->container);
$manager = new Manager();
$manager->addDriver($annotationDriver, -1);
$metadata = $manager->getMetadata($this->parsedClassName);

Expand All @@ -87,12 +80,4 @@ public function visitPhpFile(\SplFileInfo $file, MessageCatalogue $catalogue, ar
public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, \Twig_Node $node)
{
}

/**
* {@inheritdoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require": {
"php": "^7.4 || ^8.0",
"symfony/form": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/config": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/http-foundation": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/http-kernel": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
Expand Down

0 comments on commit 40955c3

Please sign in to comment.