Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Api/Data/LandingPageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public function setPageId(?string $pageId): LandingPageInterface;
public function setStoreId(int $storeId): LandingPageInterface;

/**
* @param string|null $active
* @param bool $active
* @return LandingPageInterface
*/
public function setActive(?string $active): LandingPageInterface;
public function setActive(bool $active): LandingPageInterface;

/**
* @param string|null $name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

use Magento\Framework\Api\SearchResultsInterface;

interface PageSearchResultsInterface extends SearchResultsInterface
interface LandingPageSearchResultsInterface extends SearchResultsInterface
{
/**
* Get Page list.
* @return \Emico\AttributeLanding\Api\Data\LandingPageInterface[]
*/
public function getItems(): array;
public function getItems();
}
2 changes: 1 addition & 1 deletion src/Api/Data/OverviewPageSearchResultsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ interface OverviewPageSearchResultsInterface extends SearchResultsInterface
* Get Page list.
* @return \Emico\AttributeLanding\Api\Data\OverviewPageInterface[]
*/
public function getItems(): array;
public function getItems();
}
3 changes: 2 additions & 1 deletion src/Api/LandingPageRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Api\Data\LandingPageSearchResultsInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Exception\NoSuchEntityException;

Expand Down Expand Up @@ -33,7 +34,7 @@ public function getByIdWithStore(int $pageId, int $storeId): LandingPageInterfac
* @return \Emico\AttributeLanding\Api\Data\PageSearchResultsInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(SearchCriteriaInterface $searchCriteria);
public function getList(SearchCriteriaInterface $searchCriteria): LandingPageSearchResultsInterface;

/**
* Delete Page
Expand Down
7 changes: 5 additions & 2 deletions src/Api/OverviewPageRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php

declare(strict_types=1);

namespace Emico\AttributeLanding\Api;

use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Exception\NoSuchEntityException;

Expand All @@ -29,10 +32,10 @@ public function getById(int $pageId): OverviewPageInterface;
/**
* Retrieve Page matching the specified criteria.
* @param SearchCriteriaInterface $searchCriteria
* @return \Emico\AttributeLanding\Api\Data\PageSearchResultsInterface
* @return \Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(SearchCriteriaInterface $searchCriteria);
public function getList(SearchCriteriaInterface $searchCriteria): OverviewPageSearchResultsInterface;

/**
* Delete Page
Expand Down
13 changes: 3 additions & 10 deletions src/Model/LandingPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ class LandingPage extends AbstractExtensibleModel implements LandingPageInterfac
{
protected $_eventPrefix = 'emico_attributelanding_page';

/**
* @var Config
*/
protected $config;

/**
* LandingPage constructor.
* @param Context $context
Expand All @@ -39,11 +34,11 @@ class LandingPage extends AbstractExtensibleModel implements LandingPageInterfac
* @param array $data
*/
public function __construct(
private readonly Config $config,
Context $context,
Registry $registry,
ExtensionAttributesFactory $extensionFactory,
AttributeValueFactory $customAttributeFactory,
Config $config,
AbstractResource $resource = null,
AbstractDb $resourceCollection = null,
array $data = []
Expand All @@ -57,8 +52,6 @@ public function __construct(
$resourceCollection,
$data
);

$this->config = $config;
}

/**
Expand Down Expand Up @@ -102,10 +95,10 @@ public function isActive(): bool

/**
* Set active
* @param string $active
* @param bool $active
* @return \Emico\AttributeLanding\Api\Data\LandingPageInterface
*/
public function setActive($active): LandingPageInterface
public function setActive(bool $active): LandingPageInterface
{
return $this->setData(self::ACTIVE, $active);
}
Expand Down
81 changes: 15 additions & 66 deletions src/Model/LandingPageRepository.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2017
Expand All @@ -9,11 +11,12 @@

use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Api\Data\LandingPageSearchResultsInterface;
use Emico\AttributeLanding\Api\LandingPageRepositoryInterface;
use Emico\AttributeLanding\Ui\Component\Product\Form\Categories\Options;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Api\SearchCriteriaInterface;
use Emico\AttributeLanding\Api\Data\PageSearchResultsInterfaceFactory;
use Emico\AttributeLanding\Api\Data\LandingPageSearchResultsInterfaceFactory;
use Emico\AttributeLanding\Model\ResourceModel\Page as ResourcePage;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;
Expand All @@ -26,82 +29,28 @@

class LandingPageRepository implements LandingPageRepositoryInterface
{
/**
* @var ResourcePage
*/
protected $resource;

/**
* @var PageSearchResultsInterfaceFactory
*/
protected $searchResultsFactory;

/**
* @var CollectionProcessorInterface
*/
private $collectionProcessor;

/**
* @var PageCollectionFactory
*/
protected $pageCollectionFactory;

/**
* @var LandingPageInterfaceFactory
*/
protected $dataPageFactory;

/**
* @var JoinProcessorInterface
*/
protected $extensionAttributesJoinProcessor;

/**
* @var SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;

/**
* @var StoreManagerInterface
*/
private StoreManagerInterface $storeManager;

/**
* @var Options
*/
private Options $options;

/**
* @param ResourcePage $resource
* @param LandingPageInterfaceFactory $dataPageFactory
* @param PageCollectionFactory $pageCollectionFactory
* @param PageSearchResultsInterfaceFactory $searchResultsFactory
* @param LandingPageSearchResultsInterfaceFactory $searchResultsFactory
* @param CollectionProcessorInterface $collectionProcessor
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param StoreManagerInterface $storeManager
* @param Options $options
*/
public function __construct(
ResourcePage $resource,
LandingPageInterfaceFactory $dataPageFactory,
PageCollectionFactory $pageCollectionFactory,
PageSearchResultsInterfaceFactory $searchResultsFactory,
CollectionProcessorInterface $collectionProcessor,
JoinProcessorInterface $extensionAttributesJoinProcessor,
SearchCriteriaBuilder $searchCriteriaBuilder,
StoreManagerInterface $storeManager,
Options $options
private readonly ResourcePage $resource,
private readonly LandingPageInterfaceFactory $dataPageFactory,
private readonly PageCollectionFactory $pageCollectionFactory,
private readonly LandingPageSearchResultsInterfaceFactory $searchResultsFactory,
private readonly CollectionProcessorInterface $collectionProcessor,
private readonly JoinProcessorInterface $extensionAttributesJoinProcessor,
private readonly SearchCriteriaBuilder $searchCriteriaBuilder,
private readonly StoreManagerInterface $storeManager,
private readonly Options $options
) {
$this->resource = $resource;
$this->pageCollectionFactory = $pageCollectionFactory;
$this->searchResultsFactory = $searchResultsFactory;
$this->dataPageFactory = $dataPageFactory;
$this->collectionProcessor = $collectionProcessor;
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->storeManager = $storeManager;
$this->options = $options;
}

/**
Expand Down Expand Up @@ -211,7 +160,7 @@ public function getAllPagesById(int $pageId): array
/**
* {@inheritdoc}
*/
public function getList(SearchCriteriaInterface $criteria)
public function getList(SearchCriteriaInterface $criteria): LandingPageSearchResultsInterface
{
$collection = $this->pageCollectionFactory->create();

Expand Down
13 changes: 13 additions & 0 deletions src/Model/LandingPageSearchResults.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Emico\AttributeLanding\Model;

use Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterface;
use Emico\AttributeLanding\Api\Data\PageSearchResultsInterface;
use Magento\Framework\Api\SearchResults;

class LandingPageSearchResults extends SearchResults implements PageSearchResultsInterface
{
}
53 changes: 9 additions & 44 deletions src/Model/OverviewPageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterface;
use Emico\AttributeLanding\Api\OverviewPageRepositoryInterface;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Api\SearchCriteriaInterface;
use Emico\AttributeLanding\Api\Data\PageSearchResultsInterfaceFactory;
use Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterfaceFactory;
use Emico\AttributeLanding\Model\ResourceModel\OverviewPage as ResourcePage;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;
Expand All @@ -18,36 +19,6 @@

class OverviewPageRepository implements OverviewPageRepositoryInterface
{
/**
* @var ResourcePage
*/
protected $resource;

/**
* @var PageSearchResultsInterfaceFactory
*/
protected $searchResultsFactory;

/**
* @var PageCollectionFactory
*/
protected $pageCollectionFactory;

/**
* @var OverviewPageInterfaceFactory
*/
protected $dataPageFactory;

/**
* @var SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;

/**
* @var CollectionProcessorInterface
*/
private $collectionProcessor;

/**
* @param ResourcePage $resource
* @param OverviewPageInterfaceFactory $dataPageFactory
Expand All @@ -57,19 +28,13 @@ class OverviewPageRepository implements OverviewPageRepositoryInterface
* @param SearchCriteriaBuilder $searchCriteriaBuilder
*/
public function __construct(
ResourcePage $resource,
OverviewPageInterfaceFactory $dataPageFactory,
PageCollectionFactory $pageCollectionFactory,
PageSearchResultsInterfaceFactory $searchResultsFactory,
CollectionProcessorInterface $collectionProcessor,
SearchCriteriaBuilder $searchCriteriaBuilder
private readonly ResourcePage $resource,
private readonly OverviewPageInterfaceFactory $dataPageFactory,
private readonly PageCollectionFactory $pageCollectionFactory,
private readonly OverviewPageSearchResultsInterfaceFactory $searchResultsFactory,
private readonly CollectionProcessorInterface $collectionProcessor,
private readonly SearchCriteriaBuilder $searchCriteriaBuilder
) {
$this->resource = $resource;
$this->pageCollectionFactory = $pageCollectionFactory;
$this->searchResultsFactory = $searchResultsFactory;
$this->dataPageFactory = $dataPageFactory;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->collectionProcessor = $collectionProcessor;
}

/**
Expand Down Expand Up @@ -114,7 +79,7 @@ public function getById(int $pageId): OverviewPageInterface
/**
* {@inheritdoc}
*/
public function getList(SearchCriteriaInterface $criteria)
public function getList(SearchCriteriaInterface $criteria): OverviewPageSearchResultsInterface
{
$collection = $this->pageCollectionFactory->create();

Expand Down
12 changes: 12 additions & 0 deletions src/Model/OverviewPageSearchResults.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Emico\AttributeLanding\Model;

use Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterface;
use Magento\Framework\Api\SearchResults;

class OverviewPageSearchResults extends SearchResults implements OverviewPageSearchResultsInterface
{
}
6 changes: 3 additions & 3 deletions src/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
type="Emico\AttributeLanding\Model\LandingPage"/>
<preference for="Emico\AttributeLanding\Api\Data\OverviewPageInterface"
type="Emico\AttributeLanding\Model\OverviewPage"/>
<preference for="Emico\AttributeLanding\Api\Data\PageSearchResultsInterface"
type="Magento\Framework\Api\SearchResults"/>
<preference for="Emico\AttributeLanding\Api\Data\LandingPageSearchResultsInterface"
type="Emico\AttributeLanding\Model\LandingPageSearchResults"/>
<preference for="Emico\AttributeLanding\Api\Data\OverviewPageSearchResultsInterface"
type="Magento\Framework\Api\SearchResults"/>
type="Emico\AttributeLanding\Model\OverviewPageSearchResults"/>
<preference for="Emico\AttributeLanding\Model\FilterApplier\FilterApplierInterface"
type="Emico\AttributeLanding\Model\FilterApplier\AggregateFilterApplier"/>
<preference for="Emico\AttributeLanding\Model\FilterHider\FilterHiderInterface"
Expand Down
Loading