PHP code example of punktde / sylius-api
1. Go to this page and download the library: Download punktde/sylius-api 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/ */
punktde / sylius-api example snippets
/**
* @Flow\Inject
* @var PunktDe\Sylius\Api\Resource\ProductResource
*/
protected $products;
/**
* @param string $identifier
* @return PunktDe\Sylius\Api\Dto\Product
*/
private function findOneProductByIdentifier(string $identifier): PunktDe\Sylius\Api\Dto\Product {
$this->products->get($identifier);
}
/**
* @Flow\Inject
* @var PunktDe\Sylius\Api\Resource\CartResource
*/
protected $cartResource;
/**
* @return Cart|null
*/
private function retrieveExistingCartByCustomerMail(): ?PunktDe\Sylius\Api\Dto\Cart
{
$cartCollection = $this->getCartResource()->getAll([
'customer' => [
'searchOption' => 'equal',
'searchPhrase' => $this->getLoggedInUserEmail()
]
]);
return current($cartCollection);
}