-
Notifications
You must be signed in to change notification settings - Fork 158
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
Sitemap support #152
Sitemap support #152
Conversation
sweoggy
commented
Jun 15, 2018
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Related tickets | fixes #41 |
License | MIT |
- Added SitemapPlugin to application test and dev environments - Added tests of provider
Wow! Thank you a lot! @patrick477, can I ask you to review it? |
$pageUrl = $this->sitemapUrlFactory->createNew(); | ||
$pageUrl->setChangeFrequency(ChangeFrequency::daily()); | ||
$pageUrl->setPriority(0.7); | ||
if ($page->getUpdatedAt()) { |
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.
Doesn't $page
always have an updated at? Else fall back to created at maybe?
$pageUrl->setLastModification($page->getUpdatedAt() ?? $page->getCreatedAt());
} | ||
/** @var PageTranslationInterface $translation */ | ||
foreach ($this->getTranslations($page) as $translation) { | ||
if (!$translation->getLocale()) { |
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.
Is this possible?
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.
getLocale() can return null, this is just a safeguard against that.
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.
@sweoggy I did you CR, it would be great if you would like to relate to this
->getQuery() | ||
->getResult(); | ||
} | ||
|
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.
a better way would be to add the findEnabled
method to the repository
* @var LocaleInterface | ||
*/ | ||
protected $locale2; | ||
|
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.
a better name would be $secondLocale
*/ | ||
private function getLocaleCodes(): array | ||
{ | ||
if ($this->channelLocaleCodes === null) { |
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.
a better practice would be null === $this->channelLocaleCodes
* | ||
* @return SitemapUrlInterface | ||
*/ | ||
private function createProductUrl(PageInterface $page): SitemapUrlInterface |
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.
should this method be named createPageUrl
?
} | ||
return $pageUrl; | ||
} | ||
|
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.
run the bin/ecs check src --fix
command to correct the coding standard
Thanks @stefandoorn @patrick477 for your reviews, I have made changes accordingly 😃 |
@@ -19,15 +18,20 @@ | |||
"friends-of-behat/service-container-extension": "^1.0", | |||
"friends-of-behat/symfony-extension": "^1.0", | |||
"friends-of-behat/variadic-extension": "^1.0", | |||
"lakion/api-test-case": "^1.1", |
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.
I upgraded it to ^2.0|^3.1.0
last week, which went fairly easy.
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.
Surely we would need to upgrade to PHPUnit ^6.0 at least for the whole plugin then? Feels like that belongs to a separate PR.
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.
True :)
Looks good to me :) |
@sweoggy Thank you a lot! 🙂 |