- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Adds replaceUser route and remove replaceIfExists option in createUser #62
Conversation
| Codecov Report
 @@            Coverage Diff            @@
##             4.x      #62      +/-   ##
=========================================
+ Coverage   88.7%   89.05%   +0.35%     
=========================================
  Files         15       15              
  Lines       1204     1252      +48     
=========================================
+ Hits        1068     1115      +47     
- Misses       136      137       +1
 Continue to review full report at Codecov. 
 | 
1822e37    to
    ff54832      
    Compare
  
            
          
                src/Security/Security.php
              
                Outdated
          
        
      |  | ||
| if (array_key_exists('replaceIfExist', $options)) { | ||
| $action = 'createOrReplaceUser'; | ||
| $fetchResponse = $this->kuzzle->query( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion for a cleaner code: replace lines 125-147 by following:
if ($options['replaceIfExist']) {
  $fetchResponse = $this->kuzzle->query(
    $this->buildQueryArgs('getUser'),
    ['_id' => $id]
  );
  if ($fetchResponse["error"] === null && $fetchResponse["result"]["_id"] === $id) {
    $action = 'replaceUser';
  }
}
$response = $this->kuzzle->query(
  $this->buildQueryArgs($action),
  $data,
  $options
);| Blocking: ReplaceIfExists Does not match with the new auth refactor | 
The PR has changed a lot
| hmmm. I validated, but... why do we remove the  I guess it should be implemented as for Javascript SDK : kuzzleio/sdk-javascript#208 | 
| We are removing it from all SDKs. | 
PR has been changed to remove to remove the replaceIfExists option.
fixes: https://github.com/kuzzleio/kuzzle-sdk/issues/21