| Current Path : /home/rtorresani/www/vendor/magento/module-inventory-sales/Model/ |
| Current File : //home/rtorresani/www/vendor/magento/module-inventory-sales/Model/SalesEvent.php |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\InventorySales\Model;
use Magento\InventorySalesApi\Api\Data\SalesEventInterface;
use Magento\Framework\Model\AbstractExtensibleModel;
use Magento\InventorySalesApi\Api\Data\SalesEventExtensionInterface;
/**
* @inheritdoc
*/
class SalesEvent extends AbstractExtensibleModel implements SalesEventInterface
{
/**
* @var string
*/
private $type;
/**
* @var string
*/
private $objectType;
/**
* @var string
*/
private $objectId;
/**
* SalesEvent constructor.
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param string $type
* @param string $objectType
* @param string $objectId
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
string $type,
string $objectType,
string $objectId,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
$registry,
$extensionFactory,
$customAttributeFactory,
$resource,
$resourceCollection,
$data
);
$this->type = $type;
$this->objectType = $objectType;
$this->objectId = $objectId;
}
/**
* @inheritdoc
*/
public function getType(): string
{
return $this->type;
}
/**
* @inheritdoc
*/
public function getObjectType(): string
{
return $this->objectType;
}
/**
* @inheritdoc
*/
public function getObjectId(): string
{
return $this->objectId;
}
/**
* @inheritdoc
*/
public function getExtensionAttributes(): ?SalesEventExtensionInterface
{
$extensionAttributes = $this->_getExtensionAttributes();
if (null === $extensionAttributes) {
$extensionAttributes = $this->extensionAttributesFactory->create(SalesEventInterface::class);
$this->setExtensionAttributes($extensionAttributes);
}
return $extensionAttributes;
}
/**
* @inheritdoc
*/
public function setExtensionAttributes(SalesEventExtensionInterface $extensionAttributes): void
{
$this->_setExtensionAttributes($extensionAttributes);
}
}