for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of gpupo/netshoes-sdk
* Created by Gilmar Pupo <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For more information, see <http://www.g1mr.com/>.
*/
namespace Gpupo\NetshoesSdk\Entity\Product;
use Gpupo\CommonSdk\Entity\EntityInterface;
use Gpupo\CommonSdk\Traits\PoolTrait;
use Gpupo\NetshoesSdk\Entity\ManagerAbstract;
class Manager extends ManagerAbstract
{
use PoolTrait;
protected $entity = 'Product';
protected $maps = [
'save' => ['POST', '/products'],
'findById' => ['GET', '/products/{itemId}'],
'patch' => ['PATCH', '/products/{itemId}'],
'update' => ['PUT', '/products/{itemId}'],
'fetch' => ['GET', '/products?page={offset}&size={limit}'],
];
public function save(EntityInterface $product, $route = 'save')
return $this->execute($this->factoryMap('save'), $product->toJson());
}
protected function getMap($route, Product $product)
return $this->factoryMap($route, ['itemId' => $product->getId()]);