Skip to content

Commit

Permalink
Merge branch '2.2.x' of https://github.com/Smile-SA/elasticsuite into…
Browse files Browse the repository at this point in the history
… 2.2.x
  • Loading branch information
Aurélien FOUCRET committed Nov 10, 2016
2 parents 80985b2 + b50968f commit 4b73c49
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer
* versions in the future.
*
* @category Smile
* @package Smile\ElasticsuiteVirtualCategory
* @author Romain Ruaud <romain.ruaud@smile.fr>
* @copyright 2016 Smile
* @license Open Software License ("OSL") v. 3.0
*/
namespace Smile\ElasticsuiteVirtualCategory\Api\Data;

use Magento\Catalog\Api\Data\CategoryInterface;

/**
* Virtual Category Rule Interface.
*
* @category Smile
* @package Smile\ElasticsuiteVirtualCategory
* @author Romain Ruaud <romain.ruaud@smile.fr>
*/
interface VirtualRuleInterface
{
/**
* Build search query by category.
*
* @param CategoryInterface $category Search category.
* @param array $excludedCategories Categories that should not be used into search query building.
* Used to avoid infinite recursion while building virtual categories rules.
*
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
*/
public function getCategorySearchQuery($category, $excludedCategories = []);

/**
* Retrieve search queries of children categories.
*
* @param CategoryInterface $rootCategory Root category.
*
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface[]
*/
public function getSearchQueriesByChildren(CategoryInterface $rootCategory);
}
3 changes: 2 additions & 1 deletion src/module-elasticsuite-virtual-category/Model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use Smile\ElasticsuiteCore\Search\Request\QueryInterface;
use Magento\Catalog\Api\Data\CategoryInterface;
use Smile\ElasticsuiteVirtualCategory\Api\Data\VirtualRuleInterface;

/**
* Virtual category rule.
Expand All @@ -26,7 +27,7 @@
* @package Smile\ElasticsuiteVirtualCategory
* @author Aurelien FOUCRET <aurelien.foucret@smile.fr>
*/
class Rule extends \Smile\ElasticsuiteCatalogRule\Model\Rule
class Rule extends \Smile\ElasticsuiteCatalogRule\Model\Rule implements VirtualRuleInterface
{
/**
* @var \Smile\ElasticsuiteCore\Search\Request\Query\QueryFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!--
/**
* Smile_ElasticsuiteVirtualCategory Extension Attributes Configuration.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer
* versions in the future.
*
*
* @category Smile
* @package Smile\ElasticsuiteVirtualCategory
* @author Romain Ruaud <romain.ruaud@smile.fr>
* @copyright 2016 Smile
* @license Open Software License ("OSL") v. 3.0
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\CategoryInterface">
<attribute code="virtual_rule" type="Smile\ElasticsuiteVirtualCategory\Api\Data\VirtualRuleInterface" />
</extension_attributes>
</config>

0 comments on commit 4b73c49

Please sign in to comment.