Skip to content
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

Merged
merged 4 commits into from
Jun 22, 2018
Merged

Sitemap support #152

merged 4 commits into from
Jun 22, 2018

Conversation

sweoggy
Copy link
Contributor

@sweoggy sweoggy commented Jun 15, 2018

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #41
License MIT

@bitbager
Copy link
Member

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()) {
Copy link
Contributor

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()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this possible?

Copy link
Contributor Author

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.

Copy link
Contributor

@patrick477 patrick477 left a 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();
}

Copy link
Contributor

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;

Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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;
}

Copy link
Contributor

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

@sweoggy
Copy link
Contributor Author

sweoggy commented Jun 21, 2018

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",
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True :)

@stefandoorn
Copy link
Contributor

Looks good to me :)

@patrick477 patrick477 merged commit 633781f into BitBagCommerce:master Jun 22, 2018
@patrick477
Copy link
Contributor

@sweoggy Thank you a lot! 🙂

@sweoggy sweoggy deleted the sitemap-support branch June 22, 2018 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sitemap support
4 participants