Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 124 | | All time: 9,460 This week: 524 |
|
Description | | Author |
This package can access the MoySklad API using ORM like objects.
It provides a set of classes that send HTTP requests to the MoySklad API and perform several types of operations with all types of entities like some ORM libraries perform.
It can find or load objects, set and get the object properties, save or delete objects, etc..
The package comes with MoySklad entity objects for companies, customers, orders, payments, stock items, etc.. | |
 |
|
Innovation award
 Nominee: 1x |
|
Example
<?php
namespace Zf2ClientMoysklad;
require_once __DIR__.'/_config.php';
use Zf2ClientMoysklad\Entity\Good;
use Zf2ClientMoysklad\Entity\PurchaseOrder;
use Zf2ClientMoysklad\Repository\BasicRepository;
global $sm;
/* @var $entityManager EntityManager */
$entityManager = $sm->get('zf2clientmoysklad_entity_manager');
/*====================== Method for Create purchase orders ==========================*/
$entityToOrder = '1e474a24-5cd7-11e3-00e2-7054d21a8d1e';
/* @var $goodEntity Good */
$goodEntity = $entityManager->find('Zf2ClientMoysklad\Entity\Good', $entityToOrder);
$purchaseOrder = new PurchaseOrder();
$purchaseOrderPosition = new PurchaseOrder\Position();
$entityManager->persist($purchaseOrder);
//Dealer id
$purchaseOrder->setSourceAgentUuid('2678f502-5cc9-11e3-320b-7054d21a8d1e');
//Your organisation id
$purchaseOrder->setTargetAgentUuid('266ce37b-5cc9-11e3-92f6-7054d21a8d1e');
$purchaseOrderPosition->setGoodsUuid($goodEntity->getUuid());
$purchaseOrderPosition->setPriceSum($goodEntity->getPrice());
$purchaseOrderPosition->setPriceSumInCurrency($goodEntity->getPrice());
$purchaseOrderPosition->setQuantity(1000);
$purchaseOrderPosition->setReserve(10);
$purchaseOrder->addOrderPosition($purchaseOrderPosition);
$purchaseOrderPosition = new PurchaseOrder\Position();
$purchaseOrderPosition->setGoodsUuid($goodEntity->getUuid());
$purchaseOrderPosition->setPriceSum($goodEntity->getPrice());
$purchaseOrderPosition->setPriceSumInCurrency($goodEntity->getPrice());
$purchaseOrderPosition->setQuantity(10);
$purchaseOrderPosition->setReserve(1);
$purchaseOrder->addOrderPosition($purchaseOrderPosition);
$entityManager->flush();
/*---------------------------------------------------------------------------------*/
|
Details
Client for http://www.moysklad.ru/
To setup library you have to had composer.phar.
You can download it using this command:
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
or you can follow the instructions on http://getcomposer.org/download/
Composer will install all required Zend libraries.
After the composer has been downloaded, you should run it:
chmod a+x composer.phar && ./composer.phar install
or
./composer.phar update
Simple usage examples you can found in demo/ folder.
If your project already includes Zend Framework 2, this module could be installed as Zend Framework 2 module.
You should only copy config/zf2clientmoysklad.global.php to your config/autoload and change commented line with your connection credentials.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.