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)
Main Page
Related Pages
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
c
d
e
f
g
h
i
m
p
r
s
t
u
+
Functions
_
c
d
e
f
g
h
i
m
p
r
s
t
u
Variables
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
(
_
a
b
c
d
e
f
g
h
i
j
m
n
o
p
q
r
s
t
u
v
w
+
Functions
_
c
d
e
f
g
m
o
r
s
t
v
+
Variables
$
(
_
a
b
c
d
e
f
g
h
i
j
m
n
o
p
q
r
s
t
u
v
w
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
vendor
magento
module-catalog-rule
Model
Rule
DataProvider.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\CatalogRule\Model\Rule
;
7
8
use
Magento\CatalogRule\Model\ResourceModel\Rule\Collection
;
9
use Magento\CatalogRule\Model\ResourceModel\Rule\CollectionFactory;
10
use
Magento\CatalogRule\Model\Rule
;
11
use
Magento\Framework\App\Request\DataPersistorInterface
;
12
17
class
DataProvider
extends
\Magento\Ui\DataProvider\AbstractDataProvider
18
{
22
protected
$collection
;
23
27
protected
$loadedData
;
28
32
protected
$dataPersistor
;
33
43
public
function
__construct
(
44
$name
,
45
$primaryFieldName
,
46
$requestFieldName
,
47
CollectionFactory $collectionFactory,
48
DataPersistorInterface
$dataPersistor
,
49
array
$meta
= [],
50
array
$data
= []
51
) {
52
$this->collection = $collectionFactory->create();
53
$this->dataPersistor =
$dataPersistor
;
54
parent::__construct(
$name
,
$primaryFieldName
,
$requestFieldName
,
$meta
,
$data
);
55
}
56
60
public
function
getData
()
61
{
62
if
(isset($this->loadedData)) {
63
return
$this->loadedData
;
64
}
65
$items
= $this->collection->getItems();
67
foreach
(
$items
as
$rule
) {
68
$rule
->load(
$rule
->getId());
69
$this->loadedData[
$rule
->getId()] =
$rule
->getData();
70
}
71
72
$data
= $this->dataPersistor->get(
'catalog_rule'
);
73
if
(!empty(
$data
)) {
74
$rule
= $this->collection->getNewEmptyItem();
75
$rule
->setData(
$data
);
76
$this->loadedData[
$rule
->getId()] =
$rule
->getData();
77
$this->dataPersistor->clear(
'catalog_rule'
);
78
}
79
80
return
$this->loadedData
;
81
}
82
}
Magento\Framework\App\Request\DataPersistorInterface
Definition:
DataPersistorInterface.php:12
Magento\Ui\DataProvider\AbstractDataProvider\$meta
$meta
Definition:
AbstractDataProvider.php:41
$rule
$rule
Definition:
rule_by_attribute.php:10
Magento\CatalogRule\Model\Rule
Magento\CatalogRule\Model\Rule\DataProvider\$loadedData
$loadedData
Definition:
DataProvider.php:27
Magento\CatalogRule\Model\Rule\DataProvider\$collection
$collection
Definition:
DataProvider.php:22
Magento\CatalogRule\Model\Rule\DataProvider\__construct
__construct( $name, $primaryFieldName, $requestFieldName, CollectionFactory $collectionFactory, DataPersistorInterface $dataPersistor, array $meta=[], array $data=[])
Definition:
DataProvider.php:43
Magento\Ui\DataProvider\AbstractDataProvider\$primaryFieldName
$primaryFieldName
Definition:
AbstractDataProvider.php:29
Magento\CatalogRule\Model\Rule\DataProvider\$dataPersistor
$dataPersistor
Definition:
DataProvider.php:32
Magento\CatalogRule\Model\ResourceModel\Rule\Collection
Definition:
Collection.php:11
Magento\Ui\DataProvider\AbstractDataProvider\$name
$name
Definition:
AbstractDataProvider.php:22
Magento\Ui\DataProvider\AbstractDataProvider\$data
$data
Definition:
AbstractDataProvider.php:48
Magento\Ui\DataProvider\AbstractDataProvider\$requestFieldName
$requestFieldName
Definition:
AbstractDataProvider.php:36
Magento\Ui\DataProvider\AbstractDataProvider
Definition:
AbstractDataProvider.php:15
Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product
$items
$items
Definition:
order_rollback.php:21
Magento\Ui\DataProvider\AbstractDataProvider\getData
getData()
Definition:
AbstractDataProvider.php:251