Skip to content

Commit

Permalink
Merge pull request #6 from staempfli/fix-issue1
Browse files Browse the repository at this point in the history
Fix issue #5
  • Loading branch information
Marcel Hauri authored Apr 27, 2018
2 parents e8d3821 + 933ec80 commit 0870b67
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 16 deletions.
6 changes: 6 additions & 0 deletions Api/CategoryUrlRetrieverInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
namespace Staempfli\Seo\Api;

interface CategoryUrlRetrieverInterface extends UrlRetrieverInterface
{
}
6 changes: 6 additions & 0 deletions Api/CmsPageUrlRetrieverInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
namespace Staempfli\Seo\Api;

interface CmsPageUrlRetrieverInterface extends UrlRetrieverInterface
{
}
6 changes: 6 additions & 0 deletions Api/ProductUrlRetrieverInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
namespace Staempfli\Seo\Api;

interface ProductUrlRetrieverInterface extends UrlRetrieverInterface
{
}
23 changes: 13 additions & 10 deletions Service/HrefLang/AlternativeUrlService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,33 @@

use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Store\Model\Store;
use Staempfli\Seo\Api\CategoryUrlRetrieverInterface;
use Staempfli\Seo\Api\CmsPageUrlRetrieverInterface;
use Staempfli\Seo\Api\ProductUrlRetrieverInterface;

class AlternativeUrlService
{
/**
* @var CmsPageUrlRetriever
* @var CmsPageUrlRetrieverInterface
*/
private $cmsPageUrlRetriever;
/**
* @var HttpRequest
*/
private $request;
/**
* @var CategoryUrlRetriever
* @var CategoryUrlRetrieverInterface
*/
private $categoryUrlRetriever;
/**
* @var ProductUrlRetriever
* @var ProductUrlRetrieverInterface
*/
private $productUrlRetriever;
/**
* @var HttpRequest
*/
private $request;

public function __construct(
CmsPageUrlRetriever $cmsPageUrlRetriever,
CategoryUrlRetriever $categoryUrlRetriever,
ProductUrlRetriever $productUrlRetriever,
CmsPageUrlRetrieverInterface $cmsPageUrlRetriever,
CategoryUrlRetrieverInterface $categoryUrlRetriever,
ProductUrlRetrieverInterface $productUrlRetriever,
HttpRequest $request
) {
$this->cmsPageUrlRetriever = $cmsPageUrlRetriever;
Expand Down
4 changes: 2 additions & 2 deletions Service/HrefLang/CategoryUrlRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Magento\Catalog\Model\Category;
use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
use Magento\Store\Model\Store;
use Staempfli\Seo\Api\UrlRetrieverInterface;
use Staempfli\Seo\Api\CategoryUrlRetrieverInterface;

class CategoryUrlRetriever implements UrlRetrieverInterface
class CategoryUrlRetriever implements CategoryUrlRetrieverInterface
{
/**
* @var CategoryRepositoryInterface
Expand Down
4 changes: 2 additions & 2 deletions Service/HrefLang/CmsPageUrlRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator;
use Magento\Framework\Exception\LocalizedException;
use Magento\Store\Model\Store;
use Staempfli\Seo\Api\UrlRetrieverInterface;
use Staempfli\Seo\Api\CmsPageUrlRetrieverInterface;

class CmsPageUrlRetriever implements UrlRetrieverInterface
class CmsPageUrlRetriever implements CmsPageUrlRetrieverInterface
{
/**
* @var PageRepositoryInterface
Expand Down
4 changes: 2 additions & 2 deletions Service/HrefLang/ProductUrlRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Magento\Catalog\Model\Product;
use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator;
use Magento\Store\Model\Store;
use Staempfli\Seo\Api\UrlRetrieverInterface;
use Staempfli\Seo\Api\ProductUrlRetrieverInterface;

class ProductUrlRetriever implements UrlRetrieverInterface
class ProductUrlRetriever implements ProductUrlRetrieverInterface
{
/**
* @var ProductRepositoryInterface
Expand Down
3 changes: 3 additions & 0 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Staempfli\Seo\Api\CmsPageUrlRetrieverInterface" type="Staempfli\Seo\Service\HrefLang\CmsPageUrlRetriever" />
<preference for="Staempfli\Seo\Api\CategoryUrlRetrieverInterface" type="Staempfli\Seo\Service\HrefLang\CategoryUrlRetriever" />
<preference for="Staempfli\Seo\Api\ProductUrlRetrieverInterface" type="Staempfli\Seo\Service\HrefLang\ProductUrlRetriever" />
<type name="Magento\Framework\View\Page\Config">
<plugin name="staempfli_seo" type="Staempfli\Seo\Plugin\PageConfigPlugin" />
</type>
Expand Down

0 comments on commit 0870b67

Please sign in to comment.