示例#1
0
 /**
  * Post request for creating url rewrite
  *
  * @param FixtureInterface $fixture
  * @throws \Exception
  * @return mixed|void
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . $this->url . $fixture->getIdPath();
     $data = $this->replaceMappingData($fixture->getData());
     $curl = new BackendDecorator(new CurlTransport(), new Config());
     $curl->write(CurlInterface::POST, $url, '1.0', array(), $data);
     $response = $curl->read();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Product creation by curl handler was not successful! Response: {$response}");
     }
     $curl->close();
 }