PHP code example of bestit / commercetools-async-pool
1. Go to this page and download the library: Download bestit/commercetools-async-pool library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bestit / commercetools-async-pool example snippets
$pool = new Pool($this->getClient());
$pool->addPromise(ProductTypeByIdGetRequest::ofId('example')).then(
// Success
function(ProductType $productType) use ($userdata) {
echo $productType->getId();
},
// optional error callback
function(ErrorResponse $error) {
echo $error->getStatusCode();
}
);
//.then(/* chained callbacks */)
//.then()
// ....
// Gets flushed automatically, if we overflow the tick rate from the constructor.
$pool->flush();