diff --git a/src/Api/Data/LandingPageInterface.php b/src/Api/Data/LandingPageInterface.php
index c3980e6..73aee4b 100644
--- a/src/Api/Data/LandingPageInterface.php
+++ b/src/Api/Data/LandingPageInterface.php
@@ -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
diff --git a/src/Api/Data/PageSearchResultsInterface.php b/src/Api/Data/LandingPageSearchResultsInterface.php
similarity index 74%
rename from src/Api/Data/PageSearchResultsInterface.php
rename to src/Api/Data/LandingPageSearchResultsInterface.php
index 1f4a5bb..c349f8d 100644
--- a/src/Api/Data/PageSearchResultsInterface.php
+++ b/src/Api/Data/LandingPageSearchResultsInterface.php
@@ -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();
}
diff --git a/src/Api/Data/OverviewPageSearchResultsInterface.php b/src/Api/Data/OverviewPageSearchResultsInterface.php
index 962ca5b..19fb6fe 100644
--- a/src/Api/Data/OverviewPageSearchResultsInterface.php
+++ b/src/Api/Data/OverviewPageSearchResultsInterface.php
@@ -15,5 +15,5 @@ interface OverviewPageSearchResultsInterface extends SearchResultsInterface
* Get Page list.
* @return \Emico\AttributeLanding\Api\Data\OverviewPageInterface[]
*/
- public function getItems(): array;
+ public function getItems();
}
diff --git a/src/Api/LandingPageRepositoryInterface.php b/src/Api/LandingPageRepositoryInterface.php
index 145935c..f5e0ba4 100644
--- a/src/Api/LandingPageRepositoryInterface.php
+++ b/src/Api/LandingPageRepositoryInterface.php
@@ -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;
@@ -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
diff --git a/src/Api/OverviewPageRepositoryInterface.php b/src/Api/OverviewPageRepositoryInterface.php
index 6cc33d8..016b663 100644
--- a/src/Api/OverviewPageRepositoryInterface.php
+++ b/src/Api/OverviewPageRepositoryInterface.php
@@ -1,9 +1,12 @@
config = $config;
}
/**
@@ -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);
}
diff --git a/src/Model/LandingPageRepository.php b/src/Model/LandingPageRepository.php
index a080cca..85f01f3 100644
--- a/src/Model/LandingPageRepository.php
+++ b/src/Model/LandingPageRepository.php
@@ -1,5 +1,7 @@
* @copyright (c) Emico B.V. 2017
@@ -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;
@@ -26,56 +29,11 @@
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
@@ -83,25 +41,16 @@ class LandingPageRepository implements LandingPageRepositoryInterface
* @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;
}
/**
@@ -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();
diff --git a/src/Model/LandingPageSearchResults.php b/src/Model/LandingPageSearchResults.php
new file mode 100644
index 0000000..cbd8478
--- /dev/null
+++ b/src/Model/LandingPageSearchResults.php
@@ -0,0 +1,13 @@
+resource = $resource;
- $this->pageCollectionFactory = $pageCollectionFactory;
- $this->searchResultsFactory = $searchResultsFactory;
- $this->dataPageFactory = $dataPageFactory;
- $this->searchCriteriaBuilder = $searchCriteriaBuilder;
- $this->collectionProcessor = $collectionProcessor;
}
/**
@@ -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();
diff --git a/src/Model/OverviewPageSearchResults.php b/src/Model/OverviewPageSearchResults.php
new file mode 100644
index 0000000..ca26627
--- /dev/null
+++ b/src/Model/OverviewPageSearchResults.php
@@ -0,0 +1,12 @@
+
-
+
+ type="Emico\AttributeLanding\Model\OverviewPageSearchResults"/>