Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-catalog-inventory
Model
Stock.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\CatalogInventory\Model
;
7
8
use
Magento\CatalogInventory\Api\Data\StockInterface
;
9
use
Magento\Framework\Model\AbstractExtensibleModel
;
10
15
class
Stock
extends
AbstractExtensibleModel
implements
StockInterface
16
{
20
const
ENTITY
=
'cataloginventory_stock'
;
21
27
protected
$_eventPrefix
=
'cataloginventory_stock'
;
28
35
protected
$_eventObject
=
'stock'
;
36
37
const
BACKORDERS_NO
= 0;
38
39
const
BACKORDERS_YES_NONOTIFY
= 1;
40
41
const
BACKORDERS_YES_NOTIFY
= 2;
42
43
const
STOCK_OUT_OF_STOCK
= 0;
44
45
const
STOCK_IN_STOCK
= 1;
46
47
const
WEBSITE_ID
=
'website_id'
;
48
52
const
DEFAULT_STOCK_ID
= 1;
53
57
protected
function
_construct
()
58
{
59
$this->
_init
(\
Magento
\CatalogInventory\Model\
ResourceModel
\Stock::class);
60
}
61
62
//@codeCoverageIgnoreStart
63
69
public
function
getStockId
()
70
{
71
return
$this->
_getData
(self::STOCK_ID);
72
}
73
79
public
function
getWebsiteId
()
80
{
81
return
$this->
_getData
(self::WEBSITE_ID);
82
}
83
89
public
function
getStockName
()
90
{
91
return
$this->
_getData
(self::STOCK_NAME);
92
}
93
100
public
function
setStockId
($stockId)
101
{
102
return
$this->
setData
(self::STOCK_ID, $stockId);
103
}
104
111
public
function
setWebsiteId
(
$websiteId
)
112
{
113
return
$this->
setData
(self::WEBSITE_ID,
$websiteId
);
114
}
115
122
public
function
setStockName
($stockName)
123
{
124
return
$this->
setData
(self::STOCK_NAME, $stockName);
125
}
126
132
public
function
getExtensionAttributes
()
133
{
134
return
$this->
_getExtensionAttributes
();
135
}
136
143
public
function
setExtensionAttributes
(
144
\
Magento
\CatalogInventory\Api\Data\StockExtensionInterface
$extensionAttributes
145
) {
146
return
$this->
_setExtensionAttributes
($extensionAttributes);
147
}
148
149
//@codeCoverageIgnoreEnd
150
}
Magento\CatalogInventory\Model\Stock\setExtensionAttributes
setExtensionAttributes(\Magento\CatalogInventory\Api\Data\StockExtensionInterface $extensionAttributes)
Definition:
Stock.php:143
Magento\CatalogInventory\Model\Stock\$_eventPrefix
$_eventPrefix
Definition:
Stock.php:27
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\Framework\Model\AbstractExtensibleModel\_getExtensionAttributes
_getExtensionAttributes()
Definition:
AbstractExtensibleModel.php:340
Magento\Framework\Model\AbstractExtensibleModel
Definition:
AbstractExtensibleModel.php:19
Magento\CatalogInventory\Model\Stock\STOCK_OUT_OF_STOCK
const STOCK_OUT_OF_STOCK
Definition:
Stock.php:43
Magento\CatalogInventory\Model\Stock\WEBSITE_ID
const WEBSITE_ID
Definition:
Stock.php:47
Magento\Framework\Model\AbstractExtensibleModel\_setExtensionAttributes
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
Definition:
AbstractExtensibleModel.php:329
Magento\Framework\DataObject\_getData
_getData($key)
Definition:
DataObject.php:189
Magento\Framework\Model\AbstractExtensibleModel\$extensionAttributes
$extensionAttributes
Definition:
AbstractExtensibleModel.php:30
Magento\CatalogInventory\Model\Stock\BACKORDERS_NO
const BACKORDERS_NO
Definition:
Stock.php:37
Magento\CatalogInventory\Model\Stock\getStockName
getStockName()
Definition:
Stock.php:89
Magento\CatalogInventory\Model\Stock\getStockId
getStockId()
Definition:
Stock.php:69
Magento\CatalogInventory\Model\Stock\$_eventObject
$_eventObject
Definition:
Stock.php:35
Magento\CatalogInventory\Model\Stock\BACKORDERS_YES_NOTIFY
const BACKORDERS_YES_NOTIFY
Definition:
Stock.php:41
Magento\CatalogInventory\Model\Stock\STOCK_IN_STOCK
const STOCK_IN_STOCK
Definition:
Stock.php:45
Magento\CatalogInventory\Model\Stock\ENTITY
const ENTITY
Definition:
Stock.php:20
Magento\CatalogInventory\Model\Stock\setStockName
setStockName($stockName)
Definition:
Stock.php:122
Magento\CatalogInventory\Model\Stock\DEFAULT_STOCK_ID
const DEFAULT_STOCK_ID
Definition:
Stock.php:52
Magento\CatalogInventory\Api\Data\StockInterface
Definition:
StockInterface.php:19
Magento
Magento\CatalogInventory\Model
Magento\CatalogInventory\Model\Stock\setStockId
setStockId($stockId)
Definition:
Stock.php:100
Magento\Framework\Model\AbstractExtensibleModel\setData
setData($key, $value=null)
Definition:
AbstractExtensibleModel.php:189
Magento\CatalogInventory\Model\Stock\_construct
_construct()
Definition:
Stock.php:57
Magento\CatalogInventory\Model\Stock\BACKORDERS_YES_NONOTIFY
const BACKORDERS_YES_NONOTIFY
Definition:
Stock.php:39
Magento\CatalogInventory\Model\Stock
Definition:
Stock.php:15
Magento\CatalogInventory\Model\Stock\setWebsiteId
setWebsiteId($websiteId)
Definition:
Stock.php:111
$websiteId
$websiteId
Definition:
products_with_websites_and_stores.php:11
Magento\CatalogInventory\Model\Stock\getExtensionAttributes
getExtensionAttributes()
Definition:
Stock.php:132
Magento\Framework\Model\AbstractModel\_init
_init($resourceModel)
Definition:
AbstractModel.php:213
Magento\CatalogInventory\Model\Stock\getWebsiteId
getWebsiteId()
Definition:
Stock.php:79