ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory;
|
||||
|
||||
class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @var AllSoapAndRestFactory
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @param AllSoapAndRestFactory $factory
|
||||
*/
|
||||
public function __construct(AllSoapAndRestFactory $factory)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($entityId)
|
||||
{
|
||||
return $this->factory->create()
|
||||
->setEntityId($entityId)
|
||||
->setName('testItemName')
|
||||
->setIsEnabled(true)
|
||||
->setHasOrders(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$allSoapAndRest1 = $this->factory->create()->setEntityId(1)->setName('testProduct1');
|
||||
$allSoapAndRest2 = $this->factory->create()->setEntityId(2)->setName('testProduct2');
|
||||
return [$allSoapAndRest1, $allSoapAndRest2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item)
|
||||
{
|
||||
return $this->factory->create()
|
||||
->setEntityId($item->getEntityId())
|
||||
->setName($item->getName())
|
||||
->setIsEnabled($item->isEnabled())
|
||||
->setHasOrders($item->hasOrders());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem)
|
||||
{
|
||||
return $entityItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nestedUpdate(
|
||||
$parentId,
|
||||
$entityId,
|
||||
\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
) {
|
||||
return $entityItem;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
/**
|
||||
* Both SOAP and REST Version ONE
|
||||
* @package Magento\TestModule5\Service\V1
|
||||
*/
|
||||
interface AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* Retrieve an item.
|
||||
*
|
||||
* @param int $entityId
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
* @throws \Magento\Framework\Webapi\Exception
|
||||
*/
|
||||
public function item($entityId);
|
||||
|
||||
/**
|
||||
* Retrieve all items.
|
||||
*
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* Create a new item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item);
|
||||
|
||||
/**
|
||||
* Update existing item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem);
|
||||
|
||||
/**
|
||||
* Update existing item.
|
||||
*
|
||||
* @param string $parentId
|
||||
* @param string $entityId
|
||||
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function nestedUpdate(
|
||||
$parentId,
|
||||
$entityId,
|
||||
\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
);
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V1\Entity;
|
||||
|
||||
/**
|
||||
* Some Data Object short description.
|
||||
*
|
||||
* Data Object long
|
||||
* multi line description.
|
||||
*/
|
||||
class AllSoapAndRest extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* Entity ID
|
||||
*/
|
||||
const ID = 'entity_id';
|
||||
const NAME = 'name';
|
||||
|
||||
/**
|
||||
* Is Enabled
|
||||
*/
|
||||
const ENABLED = 'enabled';
|
||||
const HAS_ORDERS = 'orders';
|
||||
|
||||
/**
|
||||
* Retrieve item ID.
|
||||
*
|
||||
* @return int Item ID
|
||||
*/
|
||||
public function getEntityId()
|
||||
{
|
||||
return $this->_get(self::ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set item ID.
|
||||
*
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData(self::ID, $entityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve item Name.
|
||||
*
|
||||
* @return string|null Item name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_get(self::NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set item Name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData(self::NAME, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if entity is enabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->_get(self::ENABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if entity is enabled
|
||||
*
|
||||
* @param bool $isEnabled
|
||||
* @return bool
|
||||
*/
|
||||
public function setIsEnabled($isEnabled)
|
||||
{
|
||||
return $this->setData(self::ENABLED, $isEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current entity has a property defined
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasOrders()
|
||||
{
|
||||
return $this->_get(self::HAS_ORDERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether current entity has a property defined
|
||||
*
|
||||
* @param bool $setHasOrders
|
||||
* @return $this
|
||||
*/
|
||||
public function setHasOrders($hasOrders)
|
||||
{
|
||||
return $this->setData(self::HAS_ORDERS, $hasOrders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method which will not be used when adding complex type field to WSDL.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldExcludedFromWsdl($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory;
|
||||
|
||||
class OverrideService implements OverrideServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var AllSoapAndRestFactory
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @param AllSoapAndRestFactory $factory
|
||||
*/
|
||||
public function __construct(AllSoapAndRestFactory $factory)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scalarUpdate($entityId, $name, $hasOrders)
|
||||
{
|
||||
return $this->factory->create()
|
||||
->setEntityId($entityId)
|
||||
->setName($name)
|
||||
->setHasOrders($hasOrders);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
interface OverrideServiceInterface
|
||||
{
|
||||
/**
|
||||
* Update existing item.
|
||||
*
|
||||
* @param string $entityId
|
||||
* @param string $name
|
||||
* @param bool $orders
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function scalarUpdate($entityId, $name, $orders);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V2;
|
||||
|
||||
use Magento\TestModule5\Service\V2\Entity\AllSoapAndRest as AllSoapAndRestEntity;
|
||||
use Magento\TestModule5\Service\V2\Entity\AllSoapAndRestFactory;
|
||||
|
||||
class AllSoapAndRest implements AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @var AllSoapAndRestFactory
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @param AllSoapAndRestFactory $factory
|
||||
*/
|
||||
public function __construct(AllSoapAndRestFactory $factory)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->factory->create()->setPrice(1)->setId($id)->setName('testItemName');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$allSoapAndRest1 = $this->factory->create()->setPrice(1)->setId(1)->setName('testProduct1');
|
||||
$allSoapAndRest2 = $this->factory->create()->setPrice(1)->setId(2)->setName('testProduct2');
|
||||
return [$allSoapAndRest1, $allSoapAndRest2];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item)
|
||||
{
|
||||
return $this->factory->create()->setPrice($item->getPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item)
|
||||
{
|
||||
$item->setName('Updated' . $item->getName());
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @return AllSoapAndRestEntity
|
||||
* @throws \Magento\Framework\Webapi\Exception
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->factory->create()->setPrice(1)->setId($id)->setName('testItemName');
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V2;
|
||||
|
||||
/**
|
||||
* Both SOAP and REST Version TWO
|
||||
* @package Magento\TestModule5\Service\V2
|
||||
*/
|
||||
interface AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* Retrieve existing item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
* @throws \Magento\Framework\Webapi\Exception
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Retrieve a list of all existing items.
|
||||
*
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* Add new item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item);
|
||||
|
||||
/**
|
||||
* Update one item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item);
|
||||
|
||||
/**
|
||||
* Delete existing item.
|
||||
*
|
||||
* @param string $id
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function delete($id);
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V2\Entity;
|
||||
|
||||
/**
|
||||
* Some Data Object short description.
|
||||
*
|
||||
* Data Object long
|
||||
* multi line description.
|
||||
*/
|
||||
class AllSoapAndRest extends \Magento\TestModule5\Service\V2\AllSoapAndRest
|
||||
{
|
||||
/**
|
||||
* Price field
|
||||
*/
|
||||
const PRICE = 'price';
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->_get(self::PRICE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user