Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Not possible to specify curl options #10

Closed
rattuscz opened this issue Sep 22, 2015 · 1 comment
Closed

Not possible to specify curl options #10

rattuscz opened this issue Sep 22, 2015 · 1 comment

Comments

@rattuscz
Copy link
Contributor

elastica client expects curl options as key => value directly put into curl_setopt :

foreach ($this->getConnection()->getConfig('curl') as $key => $param) {
                curl_setopt($curlConnection, $key, $param);
}

This is not possible as keys are CURLOPT_* constants which are integer and Config::merge helper reindexes arrays with integer keys:
DI builder users Config\Helpers::merge to build configuration array :
https://github.com/Kdyby/ElasticSearch/blob/master/src/Kdyby/ElasticSearch/DI/SearchExtension.php#L69
Helpers::merge reindexes array if keys are integers :
https://github.com/nette/di/blob/master/src/DI/Config/Helpers.php#L28-L29

Secondary issue is that just putting those constants in config is pain because ::constant(...) is not valid array key in neon syntax.

Therefore I would love to have option of using string constants, possibly same as in Kdyby/Curl - using just part after CURLOPT_ : $constant = 'CURLOPT_' . strtoupper($option) which would be processed in during config build to correct array of parameters for elastica

rattuscz added a commit to rattuscz/ElasticSearch that referenced this issue Sep 22, 2015
@fprochazka
Copy link
Member

Thank you for the pull! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants