Last active
March 18, 2021 18:12
-
-
Save tomasnorre/fa253f65bbd155b2a98eec4399dc7779 to your computer and use it in GitHub Desktop.
DI in TYPO3 10.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace AOE\Crawler; | |
use AOE\Crawler\Controller\CrawlerController; | |
use AOE\Crawler\Converter\JsonCompatibilityConverter; | |
use AOE\Crawler\CrawlStrategy\CallbackExecutionStrategy; | |
use AOE\Crawler\CrawlStrategy\CrawlStrategy; | |
use AOE\Crawler\Utility\SignalSlotUtility; | |
use TYPO3\CMS\Core\Http\Uri; | |
use TYPO3\CMS\Core\SingletonInterface; | |
use TYPO3\CMS\Core\Utility\GeneralUtility; | |
/** | |
* Fetches a URL based on the selected strategy or via a callback. | |
*/ | |
class QueueExecutor implements SingletonInterface | |
{ | |
/** | |
* @var CrawlStrategy | |
*/ | |
protected $crawlStrategy; | |
public function __construct(CrawlStrategy $crawlStrategy) | |
{ | |
$this->crawlStrategy = $crawlStrategy; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
_defaults: | |
autowire: true | |
autoconfigure: true | |
public: false | |
AOE\Crawler\: | |
resource: '../Classes/*' | |
AOE\Crawler\CrawlStrategy\CrawlStrategy: | |
alias: AOE\Crawler\CrawlStrategy\GuzzleExecutionStrategy | |
AOE\Crawler\QueueExecutor: | |
# mark public – means this service should be accessible from $container->get() | |
# and (often more important), both GeneralUtility::makeInstance() and the Extbase | |
# ObjectManager will be able to use the Symfony DI managed service | |
public: true | |
# Defining a service to be shared is equal to TYPO3's SingletonInterface behaviour | |
shared: true | |
# Configure constructor arguments | |
arguments: | |
$crawlStrategy: '@AOE\Crawler\CrawlStrategy\CrawlStrategy' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AOE\Crawler\Tests\Functional\Controller\CrawlerControllerTest::expandExcludeStringReturnsArraysOfIntegers | |
Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "AOE\Crawler\QueueExecutor": argument "$crawlStrategy" of method "__construct()" references interface "AOE\Crawler\CrawlStrategy\CrawlStrategy" but no such service exists. You should maybe alias this interface to one of these existing services: "AOE\Crawler\CrawlStrategy\GuzzleExecutionStrategy", "AOE\Crawler\CrawlStrategy\SubProcessExecutionStrategy". |
Do you have a link to where I describe the problem? The gist alone is't ringing any bell for me unfortunately.
I will remember the next time to ask in the gist as well adding the solution.
sorry, no. I just found this gist through a search engine.
I found it from a twitter search for the url:
https://twitter.com/tomasnorre/status/1315330213018992643
I cannot complete recall, but reading through the commits I think this was the change I did to fix my problem.
AOEpeople/crawler@c9d0889
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you solve the error?