-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Setono/synonyms
Improve synonym functionality
- Loading branch information
Showing
23 changed files
with
326 additions
and
48 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
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusMeilisearchPlugin\Form\Type; | ||
|
||
use Setono\SyliusMeilisearchPlugin\Config\IndexRegistryInterface; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
final class IndexChoiceType extends AbstractType | ||
{ | ||
public function __construct(private readonly IndexRegistryInterface $indexRegistry) | ||
{ | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$names = $this->indexRegistry->getNames(); | ||
|
||
$resolver->setDefaults([ | ||
'choices' => array_combine($names, $names), | ||
'choice_label' => static fn (string $name): string => ucfirst($name), | ||
]); | ||
} | ||
|
||
public function getParent(): string | ||
{ | ||
return ChoiceType::class; | ||
} | ||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'setono_sylius_meilisearch_index_choice'; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusMeilisearchPlugin\Grid\Filter; | ||
|
||
use Sylius\Component\Grid\Data\DataSourceInterface; | ||
use Sylius\Component\Grid\Filtering\FilterInterface; | ||
|
||
class IndexFilter implements FilterInterface | ||
{ | ||
public function apply(DataSourceInterface $dataSource, string $name, $data, array $options): void | ||
{ | ||
if (!is_string($data) || '' === $data) { | ||
return; | ||
} | ||
|
||
$dataSource->restrict($dataSource->getExpressionBuilder()->like($name, '%"' . $data . '"%')); | ||
} | ||
} |
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
Oops, something went wrong.