-
-
Notifications
You must be signed in to change notification settings - Fork 56
Fixed DoctrineMigrationsPass not working with latest Symfony 3.4+ #1590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
$reflection = new \ReflectionClass($pass); | ||
$beforeRemovingClasses[] = $reflection->getName(); | ||
} | ||
|
||
$this->assertContains(AddPackagesPass::class, $classes); | ||
$this->assertContains(AddSessionBagsPass::class, $classes); | ||
$this->assertContains(AddResourcesPathsPass::class, $classes); | ||
$this->assertContains(AddImagineClassPass::class, $classes); | ||
$this->assertContains(DoctrineMigrationsPass::class, $classes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we delete this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be in both arrays 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should change getPasses()
to getBeforeOptimizationPasses()
to be more explicit then.
Thank you @Toflar. |
Description ----------- | Q | A | -----------------| --- | Fixed issues | - | Docs PR or issue | Related to contao/docs#322 While working on an example for contao/docs#322 I noticed a possible problem within the current `RobotsTxtListener` of Contao. No matter what I tried, the resulting `robots.txt` was always ``` user-agent:* disallow:/foo/ disallow:/contao/ user-agent:* disallow:/contao/ ``` instead of ``` user-agent:* disallow:/foo/ disallow:/contao/ ``` when using the following `App\EventListener\RobotsTxtListener`: ```php // src/EventListener/RobotsTxtListener.php namespace App\EventListener; use Contao\CoreBundle\Event\ContaoCoreEvents; use Contao\CoreBundle\Event\RobotsTxtEvent; use Terminal42\ServiceAnnotationBundle\Annotation\ServiceTag; use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface; use webignition\RobotsTxt\Directive\Directive; use webignition\RobotsTxt\Record\Record; /** * @ServiceTag("kernel.event_listener", event=ContaoCoreEvents::ROBOTS_TXT) */ class RobotsTxtListener implements ServiceAnnotationInterface { public function __invoke(RobotsTxtEvent $event): void { $file = $event->getFile(); // If no directive for user-agent: * exists, we add the record if (0 === count($file->getRecords())) { $record = new Record(); $this->addDirectivesToRecord($record); $file->addRecord($record); } foreach ($file->getRecords() as $record) { $this->addDirectivesToRecord($record); } } private function addDirectivesToRecord(Record $record): void { $directiveList = $record->getDirectiveList(); $directiveList->add(new Directive('Disallow', '/foo/')); } } ``` The `App\EventListener\RobotsTxtListener` is actually executed before the `Contao\CoreBundle\EventListener\RobotsTxtListener` (when using no priority setting). So, even though `App\EventListener\RobotsTxtListener` already added a record, the following check still holds true: https://github.com/contao/contao/blob/7de5fddec93c9a575166296da06e40a5f3e1c9b9/core-bundle/src/EventListener/RobotsTxtListener.php#L42-L52 This PR simply counts the returned records directly - but may be I am overlooking something here. Commits ------- c0b4b126 fix robots.txt listener 0649ea9c add user-agent directive 9c18d11a remove superfluous function cc9c51a8 undo comment change 5d7302b9 adjust test
The changes in symfony/symfony#27272 broke our support for doctrine migrations support.