Skip to content

Commit a6b8491

Browse files
committed
Fix meili:create when the configuration has no settings
1 parent 3c13cbc commit a6b8491

File tree

4 files changed

+85
-70
lines changed

4 files changed

+85
-70
lines changed

composer.json

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,75 @@
11
{
2-
"name": "meilisearch/search-bundle",
3-
"description": "Seamless integration of Meilisearch into your Symfony project.",
4-
"keywords": [
5-
"meilisearch",
6-
"instant",
7-
"search",
8-
"api",
9-
"symfony",
10-
"bundle"
11-
],
12-
"type": "symfony-bundle",
13-
"license": "MIT",
14-
"authors": [
15-
{
16-
"name": "David Sanchez",
17-
"email": "[email protected]"
18-
}
19-
],
20-
"require": {
21-
"php": "^7.4|^8.0",
22-
"ext-json": "*",
23-
"doctrine/doctrine-bundle": "^2.4",
24-
"illuminate/collections": "^8.47",
25-
"meilisearch/meilisearch-php": "^0.23.0",
26-
"symfony/filesystem": "^4.4 || ^5.0 || ^6.0",
27-
"symfony/property-access": "^4.4 || ^5.0 || ^6.0",
28-
"symfony/serializer": "^4.4 || ^5.0 || ^6.0"
29-
},
30-
"require-dev": {
31-
"doctrine/orm": "^2.9",
32-
"friendsofphp/php-cs-fixer": "^3.0",
33-
"nyholm/psr7": "^1.3",
34-
"phpstan/extension-installer": "^1.1",
35-
"phpstan/phpstan": "^0.12.90",
36-
"phpstan/phpstan-doctrine": "^0.12.39",
37-
"phpstan/phpstan-phpunit": "^0.12.20",
38-
"phpstan/phpstan-symfony": "^0.12.37",
39-
"phpunit/php-code-coverage": "^9.2",
40-
"phpunit/phpunit": "^9.5",
41-
"symfony/doctrine-bridge": "^4.4 || ^5.0 || ^6.0",
42-
"symfony/http-client": "^4.4 || ^5.0 || ^6.0",
43-
"symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0",
44-
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
45-
},
46-
"autoload": {
47-
"psr-4": {
48-
"MeiliSearch\\Bundle\\": "src/"
49-
}
50-
},
51-
"autoload-dev": {
52-
"psr-4": {
53-
"MeiliSearch\\Bundle\\Test\\": "tests/"
54-
}
55-
},
56-
"config": {
57-
"sort-packages": true,
58-
"allow-plugins": {
59-
"phpstan/extension-installer": true
60-
}
61-
},
62-
"scripts": {
63-
"phpstan": "./vendor/bin/phpstan --memory-limit=1G --ansi",
64-
"test:unit": "./vendor/bin/phpunit --colors=always --verbose",
65-
"test:unit:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --colors=always --coverage-html=tests/coverage",
66-
"lint:check": "./vendor/bin/php-cs-fixer fix -v --using-cache=no --dry-run",
67-
"lint:fix": "./vendor/bin/php-cs-fixer fix -v --using-cache=no"
2+
"name": "meilisearch/search-bundle",
3+
"description": "Seamless integration of Meilisearch into your Symfony project.",
4+
"keywords": [
5+
"meilisearch",
6+
"instant",
7+
"search",
8+
"api",
9+
"symfony",
10+
"bundle"
11+
],
12+
"type": "symfony-bundle",
13+
"license": "MIT",
14+
"authors": [
15+
{
16+
"name": "David Sanchez",
17+
"email": "[email protected]"
6818
}
19+
],
20+
"repositories": [
21+
{
22+
"type": "git",
23+
"url": "https://github.com/meilisearch/meilisearch-php"
24+
}
25+
],
26+
"require": {
27+
"php": "^7.4|^8.0",
28+
"ext-json": "*",
29+
"doctrine/doctrine-bundle": "^2.4",
30+
"illuminate/collections": "^8.47",
31+
"meilisearch/meilisearch-php": "dev-bump-meilisearch-v0.28.0 as 1.2.3",
32+
"symfony/filesystem": "^4.4 || ^5.0 || ^6.0",
33+
"symfony/property-access": "^4.4 || ^5.0 || ^6.0",
34+
"symfony/serializer": "^4.4 || ^5.0 || ^6.0"
35+
},
36+
"require-dev": {
37+
"doctrine/orm": "^2.9",
38+
"friendsofphp/php-cs-fixer": "^3.0",
39+
"nyholm/psr7": "^1.3",
40+
"phpstan/extension-installer": "^1.1",
41+
"phpstan/phpstan": "^0.12.90",
42+
"phpstan/phpstan-doctrine": "^0.12.39",
43+
"phpstan/phpstan-phpunit": "^0.12.20",
44+
"phpstan/phpstan-symfony": "^0.12.37",
45+
"phpunit/php-code-coverage": "^9.2",
46+
"phpunit/phpunit": "^9.5",
47+
"symfony/doctrine-bridge": "^4.4 || ^5.0 || ^6.0",
48+
"symfony/http-client": "^4.4 || ^5.0 || ^6.0",
49+
"symfony/phpunit-bridge": "^4.4 || ^5.0 || ^6.0",
50+
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
51+
},
52+
"autoload": {
53+
"psr-4": {
54+
"MeiliSearch\\Bundle\\": "src/"
55+
}
56+
},
57+
"autoload-dev": {
58+
"psr-4": {
59+
"MeiliSearch\\Bundle\\Test\\": "tests/"
60+
}
61+
},
62+
"config": {
63+
"sort-packages": true,
64+
"allow-plugins": {
65+
"phpstan/extension-installer": true
66+
}
67+
},
68+
"scripts": {
69+
"phpstan": "./vendor/bin/phpstan --memory-limit=1G --ansi",
70+
"test:unit": "./vendor/bin/phpunit --colors=always --verbose",
71+
"test:unit:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --colors=always --coverage-html=tests/coverage",
72+
"lint:check": "./vendor/bin/php-cs-fixer fix -v --using-cache=no --dry-run",
73+
"lint:fix": "./vendor/bin/php-cs-fixer fix -v --using-cache=no"
74+
}
6975
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ services:
1616
- ./:/home/package:rw,cached
1717

1818
meilisearch:
19-
image: getmeili/meilisearch:latest
19+
image: getmeili/meilisearch:v0.28.0rc1
2020
ports:
2121
- "7700"
2222
environment:

src/Command/MeiliSearchCreateCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7272

7373
$output->writeln('<info>Creating index '.$index['name'].' for '.$entityClassName.'</info>');
7474

75-
$indexInstance = $this->searchClient->index($index['name']);
75+
$task = $this->searchClient->createIndex($index['name']);
76+
$this->searchClient->waitForTask($task['uid']);
77+
$indexInstance = $this->searchClient->getIndex($index['name']);
7678

7779
if (isset($index['settings']) && is_array($index['settings'])) {
7880
foreach ($index['settings'] as $variable => $value) {
@@ -83,8 +85,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8385
}
8486

8587
$task = $indexInstance->{$method}($value);
86-
87-
$indexInstance->waitForTask($task['uid']);
8888
$task = $indexInstance->getTask($task['uid']);
8989

9090
if ('failed' === $task['status']) {

tests/Integration/CommandsTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,13 @@ public function testSearchCreateWithIndices(): void
320320

321321
EOD, $createOutput);
322322
}
323+
324+
public function testCreateExecuteIndexCreation(): void
325+
{
326+
$createCommand = $this->application->find('meili:create');
327+
$createCommandTester = new CommandTester($createCommand);
328+
$createCommandTester->execute([]);
329+
330+
$this->assertEquals($this->client->getTasks()->getResults()[0]['type'], 'indexCreation');
331+
}
323332
}

0 commit comments

Comments
 (0)