-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To modify the query and response to Makaira API, with DI.
- Loading branch information
Showing
6 changed files
with
129 additions
and
2 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
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Makaira\Connect\Event; | ||
|
||
use Makaira\Result; | ||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* After receiving the Auggester, you can still adjust it for the display. | ||
*/ | ||
class AutoSuggesterResponseEvent extends Event | ||
{ | ||
public const NAME = 'makaira.response.autosuggester'; | ||
|
||
private $result; | ||
|
||
public function __construct(Result &$result) | ||
{ | ||
$this->result = $result; | ||
} | ||
|
||
/** | ||
* @return Result | ||
*/ | ||
public function getResult() | ||
{ | ||
return $this->result; | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Makaira\Connect\Event; | ||
|
||
use Makaira\Query; | ||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* Possibility to change the query before sending it to Makaira. | ||
*/ | ||
class ModifierQueryRequestEvent extends Event | ||
{ | ||
public const NAME_SEARCH = 'makaira.request.modifier.query.search'; | ||
|
||
public const NAME_AUTOSUGGESTER = 'makaira.request.modifier.query.autosuggester'; | ||
|
||
private $query; | ||
|
||
public function __construct(Query $query) | ||
{ | ||
$this->query = $query; | ||
} | ||
|
||
/** | ||
* @return Query | ||
*/ | ||
public function getQuery() | ||
{ | ||
return $this->query; | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Makaira\Connect\Event; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* After receiving the $productIds you can still adjust them | ||
*/ | ||
class SearchResponseEvent extends Event | ||
{ | ||
public const NAME = 'makaira.response.search'; | ||
|
||
private array $productIds; | ||
|
||
public function __construct(array &$productIds) | ||
{ | ||
$this->productIds = $productIds; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getProductIds() | ||
{ | ||
return $this->productIds; | ||
} | ||
} |
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