-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add event to add product data on indexation and filter on search
- Loading branch information
1 parent
aae2e5b
commit 2153ec6
Showing
5 changed files
with
192 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace ElasticProduct\Event; | ||
|
||
use Thelia\Core\Event\ActionEvent; | ||
use Thelia\Model\Product; | ||
|
||
class ProductIndexationEvent extends ActionEvent | ||
{ | ||
CONST GET_PRODUCT_DATA_EVENT = 'get_product_data_event'; | ||
|
||
/** | ||
* @var Product | ||
*/ | ||
protected $product; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $productData; | ||
|
||
public function __construct(Product $product) | ||
{ | ||
$this->product = $product; | ||
} | ||
|
||
/** | ||
* @return Product | ||
*/ | ||
public function getProduct() | ||
{ | ||
return $this->product; | ||
} | ||
|
||
/** | ||
* @param Product $product | ||
* | ||
* @return ProductIndexationEvent | ||
*/ | ||
public function setProduct($product) | ||
{ | ||
$this->product = $product; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getProductData() | ||
{ | ||
return $this->productData; | ||
} | ||
|
||
/** | ||
* @param array $productData | ||
* | ||
* @return ProductIndexationEvent | ||
*/ | ||
public function setProductData(array $productData) | ||
{ | ||
$this->productData = $productData; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param $name | ||
* @param $value | ||
* | ||
* @return $this | ||
*/ | ||
public function addProductData($name, $value) | ||
{ | ||
$this->productData[$name] = $value; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param $name | ||
* @param $value | ||
* | ||
* @return $this | ||
*/ | ||
public function removeProductData($name) | ||
{ | ||
unset($this->productData[$name]); | ||
return $this; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace ElasticProduct\Event\SearchEvent; | ||
|
||
use Thelia\Core\Event\ActionEvent; | ||
use Thelia\Core\HttpFoundation\Request; | ||
|
||
class SearchFilterEvent extends ActionEvent | ||
{ | ||
CONST GET_SEARCH_FILTER_EVENT = 'get_search_filter_event'; | ||
|
||
/** | ||
* @var Request | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $filters; | ||
|
||
public function __construct(Request $request) | ||
{ | ||
$this->request = $request; | ||
} | ||
|
||
/** | ||
* @return Request | ||
*/ | ||
public function getRequest() | ||
{ | ||
return $this->request; | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* | ||
* @return SearchFilterEvent | ||
*/ | ||
public function setRequest($request) | ||
{ | ||
$this->request = $request; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getFilters() | ||
{ | ||
return $this->filters; | ||
} | ||
|
||
/** | ||
* @param array $filters | ||
* | ||
* @return SearchFilterEvent | ||
*/ | ||
public function setFilters($filters) | ||
{ | ||
$this->filters = $filters; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param $value | ||
* | ||
* @return $this | ||
*/ | ||
public function addFilter($value) | ||
{ | ||
$this->filters[] = $value; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters