ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1;
|
||||
|
||||
use Magento\TestModule4\Service\V1\Entity\DataObjectRequest;
|
||||
use Magento\TestModule4\Service\V1\Entity\DataObjectResponseFactory;
|
||||
use Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface;
|
||||
use Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest;
|
||||
|
||||
class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var DataObjectResponseFactory
|
||||
*/
|
||||
protected $responseFactory;
|
||||
|
||||
/**
|
||||
* @param DataObjectResponseFactory $responseFactory
|
||||
*/
|
||||
public function __construct(DataObjectResponseFactory $responseFactory)
|
||||
{
|
||||
$this->responseFactory = $responseFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData($id)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName("Test");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function updateData($id, DataObjectRequest $request)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName($request->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nestedData($id, NestedDataObjectRequest $request)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName($request->getDetails()->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test return scalar value
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
*/
|
||||
public function scalarResponse($id)
|
||||
{
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function extensibleDataObject($id, ExtensibleRequestInterface $request)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName($request->getName());
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule4\Service\V1;
|
||||
|
||||
use Magento\TestModule4\Service\V1\Entity\DataObjectRequest;
|
||||
use Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest;
|
||||
|
||||
interface DataObjectServiceInterface
|
||||
{
|
||||
/**
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function getData($id);
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\DataObjectRequest $request
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function updateData($id, DataObjectRequest $request);
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest $request
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function nestedData($id, NestedDataObjectRequest $request);
|
||||
|
||||
/**
|
||||
* Test return scalar value
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
*/
|
||||
public function scalarResponse($id);
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface $request
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function extensibleDataObject(
|
||||
$id,
|
||||
\Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface $request
|
||||
);
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
class DataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_get('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getEntityId()
|
||||
{
|
||||
return $this->_get('entity_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData('entity_id', $entityId);
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
class DataObjectResponse extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getEntityId()
|
||||
{
|
||||
return $this->_get('entity_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData('entity_id', $entityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_get('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
/**
|
||||
* Class ExtensibleRequest
|
||||
*
|
||||
* @method \Magento\TestModule4\Service\V1\Entity\ExtensibleRequestExtensionInterface getExtensionAttributes()
|
||||
*/
|
||||
class ExtensibleRequest extends \Magento\Framework\Model\AbstractExtensibleModel implements ExtensibleRequestInterface
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return $this->getData("name");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData("name", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData("entity_id", $entityId);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
interface ExtensibleRequestInterface extends \Magento\Framework\Api\ExtensibleDataInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name);
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getEntityId();
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
class NestedDataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectRequest
|
||||
*/
|
||||
public function getDetails()
|
||||
{
|
||||
return $this->_get('details');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details
|
||||
* @return $this
|
||||
*/
|
||||
public function setDetails(\Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details = null)
|
||||
{
|
||||
return $this->setData('details', $details);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user