Skip to content

Update meilisearch/meilisearch-php requirement from ^0.11 to ^0.12 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require": {
"php": "^7.2",
"ext-json": "*",
"meilisearch/meilisearch-php": "^0.11",
"meilisearch/meilisearch-php": "^0.12",
"symfony/filesystem": "^4.0 || ^5.0",
"symfony/property-access": "^4.0 || ^5.0",
"symfony/serializer": "^4.0 || ^5.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<service id="search.client" class="MeiliSearch\Client" public="true" lazy="true">
<argument key="$url">%env(MEILISEARCH_URL)%</argument>
<argument key="$api_key">%env(MEILISEARCH_API_KEY)%</argument>
<argument key="$apiKey">%env(MEILISEARCH_API_KEY)%</argument>
Copy link
Member

@curquiza curquiza Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried... Why does this line fix the test? @emulienfou

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@curquiza Because in the package meilisearch-php the constructor argument has been rename from snake_case to camelCase since version 0.12.0

Copy link
Member

@curquiza curquiza Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not realize that: for me the apiKey value was only internal... I did not know that the user can access it this way! Good to know!

Copy link
Member

@curquiza curquiza Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in php, changing a variable name in the parameter for a method is breaking? Or only for constructors? @emulienfou

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@curquiza a constructor is public instead if you make it protected or private.
In Symfony I created a new service who create a new instance of MeiliSearch/Client and passing some parameters like the apiKey.
The code need to know the parameter's name to do that

Copy link
Member

@curquiza curquiza Jul 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emulienfou for me, you call the constructor this way:

$client = new Client('http://127.0.0.1:7700', 'masterKey');

No matter what the name of the parameters. I did not realize you can call the constructor the way you did in PHP! That's why I ask if you can do the same with a "basic" method, not a constructor.

Thanks a lot! I learn more and more in PHP 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@curquiza This is more related to Symfony than PHP itself.
You can find more information about Symfony Services right here: https://symfony.com/doc/current/service_container.html#manually-wiring-arguments

</service>

<service id="MeiliSearch\Client" alias="search.client"/>
Expand Down