1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Silverback API Components Bundle Project |
5
|
|
|
* |
6
|
|
|
* (c) Daniel West <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Silverback\ApiComponentsBundle\Command; |
15
|
|
|
|
16
|
|
|
use Silverback\ApiComponentsBundle\Event\CommandLogEvent; |
17
|
|
|
use Silverback\ApiComponentsBundle\Helper\Form\FormCachePurger; |
18
|
|
|
use Symfony\Component\Console\Attribute\AsCommand; |
19
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
20
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
21
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
22
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @author Daniel West <[email protected]> |
26
|
|
|
*/ |
27
|
|
|
#[AsCommand(name: 'silverback:api-components:form-cache-purge', description: 'Purges the varnish cache for forms. Sets the `modified` timestamp to the file last modified date')] |
28
|
|
|
class FormCachePurgeCommand extends Command |
29
|
|
|
{ |
30
|
|
|
private FormCachePurger $formCachePurger; |
31
|
|
|
private EventDispatcherInterface $dispatcher; |
32
|
|
|
|
33
|
|
|
public function __construct(FormCachePurger $formCachePurger, EventDispatcherInterface $dispatcher) |
34
|
|
|
{ |
35
|
|
|
parent::__construct(); |
36
|
|
|
$this->formCachePurger = $formCachePurger; |
37
|
|
|
$this->dispatcher = $dispatcher; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @return int|void|null |
42
|
|
|
*/ |
43
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int |
44
|
|
|
{ |
45
|
|
|
$this->dispatcher->addListener( |
46
|
|
|
CommandLogEvent::class, |
47
|
|
|
static function (CommandLogEvent $event) use ($output) { |
48
|
|
|
$output->writeln($event->getSubject()); |
49
|
|
|
} |
50
|
|
|
); |
51
|
|
|
$this->formCachePurger->clear(); |
52
|
|
|
$output->writeln('Form cache purge complete'); |
53
|
|
|
|
54
|
|
|
return 0; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths