Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Curl Class Reference
Inheritance diagram for Curl:
SynonymGroupInterface

Public Member Functions

 persist (FixtureInterface $fixture=null)
 

Protected Attributes

 $saveUrl = 'search/synonyms/save/'
 
 $mappingData
 

Detailed Description

Curl handler for creating Synonym Group.

Definition at line 17 of file Curl.php.

Member Function Documentation

◆ persist()

persist ( FixtureInterface  $fixture = null)

POST request for creating Synonym Group.

Parameters
FixtureInterface | null$fixture[optional]
Returns
array
Exceptions

Definition at line 50 of file Curl.php.

51  {
52  $data = $this->replaceMappingData($fixture->getData());
53 
54  $url = $_ENV['app_backend_url'] . $this->saveUrl;
55  $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
56  $curl->write($url, $data);
57  $response = $curl->read();
58  $curl->close();
59  if (strpos($response, 'data-ui-id="messages-message-success"') === false) {
60  throw new \Exception(
61  "Synonym Group entity creation by curl handler was not successful! Response: $response"
62  );
63  }
64 
65  preg_match("`group_id\/(\d*?)\/`", $response, $matches);
66  $id = isset($matches[1]) ? $matches[1] : null;
67 
68  return ['group_id' => $id];
69  }
$response
Definition: 404.php:11
$id
Definition: fieldset.phtml:14

Field Documentation

◆ $mappingData

$mappingData
protected
Initial value:
= [
'mergeOnConflict' => [
'Yes' => 1,
'No' => 0,
],
'scope_id' => [
'All Websites' => '0:0',
'All Store Views' => '1:0',
'Default Store View' => '1:1',
],
]

Definition at line 31 of file Curl.php.

◆ $saveUrl

$saveUrl = 'search/synonyms/save/'
protected

Definition at line 24 of file Curl.php.


The documentation for this class was generated from the following file: