Skip to content

Commit 255db5a

Browse files
committed
Remove usage of deprecated ContainerAwareTrait
1 parent 9d67f8c commit 255db5a

File tree

3 files changed

+13
-25
lines changed

3 files changed

+13
-25
lines changed

src/bundle/ApiLoader/BoostFactorProviderFactory.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
namespace Ibexa\Bundle\Solr\ApiLoader;
99

1010
use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface;
11-
use Ibexa\Solr\FieldMapper\BoostFactorProvider;
12-
use LogicException;
13-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
14-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
11+
use Symfony\Component\DependencyInjection\ContainerInterface;
1512

1613
/**
1714
* BoostFactorProvider service factory takes into account boost factor semantic configuration.
1815
*/
19-
class BoostFactorProviderFactory implements ContainerAwareInterface
16+
class BoostFactorProviderFactory
2017
{
21-
use ContainerAwareTrait;
18+
private ContainerInterface $container;
2219

2320
private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider;
2421

@@ -37,21 +34,19 @@ class BoostFactorProviderFactory implements ContainerAwareInterface
3734
* @param string $boostFactorProviderClass
3835
*/
3936
public function __construct(
37+
ContainerInterface $container,
4038
RepositoryConfigurationProviderInterface $repositoryConfigurationProvider,
4139
$defaultConnection,
4240
$boostFactorProviderClass
4341
) {
42+
$this->container = $container;
4443
$this->repositoryConfigurationProvider = $repositoryConfigurationProvider;
4544
$this->defaultConnection = $defaultConnection;
4645
$this->boostFactorProviderClass = $boostFactorProviderClass;
4746
}
4847

4948
public function buildService()
5049
{
51-
if ($this->container === null) {
52-
throw new LogicException(sprintf('Unable to build %s due to missing container reference', BoostFactorProvider::class));
53-
}
54-
5550
$repositoryConfig = $this->repositoryConfigurationProvider->getRepositoryConfig();
5651

5752
$connection = $this->defaultConnection;

src/bundle/ApiLoader/IndexingDepthProviderFactory.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
namespace Ibexa\Bundle\Solr\ApiLoader;
1010

1111
use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface;
12-
use Ibexa\Solr\FieldMapper\IndexingDepthProvider;
13-
use LogicException;
14-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
15-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
12+
use Symfony\Component\DependencyInjection\ContainerInterface;
1613

17-
class IndexingDepthProviderFactory implements ContainerAwareInterface
14+
class IndexingDepthProviderFactory
1815
{
19-
use ContainerAwareTrait;
16+
private ContainerInterface $container;
2017

2118
private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider;
2219

@@ -25,21 +22,19 @@ class IndexingDepthProviderFactory implements ContainerAwareInterface
2522
private string $indexingDepthProviderClass;
2623

2724
public function __construct(
25+
ContainerInterface $container,
2826
RepositoryConfigurationProviderInterface $repositoryConfigurationProvider,
2927
string $defaultConnection,
3028
string $indexingDepthProviderClass
3129
) {
30+
$this->container = $container;
3231
$this->repositoryConfigurationProvider = $repositoryConfigurationProvider;
3332
$this->defaultConnection = $defaultConnection;
3433
$this->indexingDepthProviderClass = $indexingDepthProviderClass;
3534
}
3635

3736
public function buildService()
3837
{
39-
if ($this->container === null) {
40-
throw new LogicException(sprintf('Unable to build %s due to missing container reference', IndexingDepthProvider::class));
41-
}
42-
4338
$repositoryConfig = $this->repositoryConfigurationProvider->getRepositoryConfig();
4439

4540
$connection = $this->defaultConnection;

src/bundle/Resources/config/services.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,17 @@ services:
4444

4545
Ibexa\Bundle\Solr\ApiLoader\BoostFactorProviderFactory:
4646
arguments:
47+
- '@service_container'
4748
- '@Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider'
4849
- "%ibexa.solr.default_connection%"
49-
- Ibexa\Solr\FieldMapper\BoostFactorProvider
50-
calls:
51-
- [setContainer, ["@service_container"]]
50+
- 'Ibexa\Solr\FieldMapper\BoostFactorProvider'
5251

5352
Ibexa\Bundle\Solr\ApiLoader\IndexingDepthProviderFactory:
5453
arguments:
54+
- '@service_container'
5555
- '@Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider'
5656
- "%ibexa.solr.default_connection%"
5757
- Ibexa\Solr\FieldMapper\IndexingDepthProvider
58-
calls:
59-
- [setContainer, ["@service_container"]]
6058

6159
Ibexa\Solr\FieldMapper\IndexingDepthProvider:
6260
class: Ibexa\Solr\FieldMapper\IndexingDepthProvider

0 commit comments

Comments
 (0)